iBar (7/30/2012)
Hi,Which one is a better design strategy with respect to flexibility, performance and maintainability?
A1: Defining Nullable columns in one table
OR
A2: Define character keys to identify attributes an entity/table and only populate the keys when data is available?
For example:
In A1 design table is
Employee (Emp)
EmpId, name, pay, department, dob, doj, dot
In A2 design
Employee (emp)
id, name, pay
Employee detail (edt)
EmpId, EdtId, Edt_Data_type, data_value
A1 is good for easy maintainance and might give better performance for reporting and searching? Might be more good with sparse columns?
A2 is giving more flexibility in terms of future enhancements and easy adoptability of any enhancement. Simply add a new EdtID and no structural changes required as such. So lesser future development?
What do you suggest?
Thanks.
How about durability and history? I wouldn't put pay rate in the same table as the employee information, for example. I would, however, have a Type 2 Slowing Changing Dimension table for such a thing. Same for phone numbers, addresses, department history, and a couple of other things.
--Jeff Moden
Change is inevitable... Change for the better is not.