I was wondering which approach is better for designing databases?
I have currently one big table (97 columns per row) with references to lookup tables where I could.
Wouldn’t it be better for performance to group some columns into smaller tables and add them key columns for referencing one whole row?
If you split up your table into several parts, you’ll need additional joins to get all your columns for a single row – that will cost you time.
97 columns isn’t much, really – I’ve seen way beyond 100.
It all depends on how your data is being used – if your row just has 97 columns, all the time, and needs to 97 columns – then it really hardly ever makes sense to split those up into various tables.
It might make sense if:
you can move some “large” columns (like
XML,VARCHAR(MAX)etc.) into a separate table, if you don’t need those all the time -> in that case, your “basic” row becomes smaller and your basic table will perform better – as long as you don’t need those extra large columnyou can move away some columns to a separate table that aren’t always present, e.g. columns that might be “optional” and only present for e.g. 20% of the rows – in that case, you might save yourself some processing for the remaining 80% of the cases where those columns aren’t needed.