Is it a dangerous practice to have tables with large number of columns. Is there possibi开发者_C百科lity of some performance or memory issues? My DB is Oracle 10g. It is easier to add columns for existing table then rearrange structure of db in my case. I'm talking about 30-50 additional columns to the table that already has had about 50 columns in it.
It isn't dangerous, per se, but it is usually a sign of poor design. Are these extra columns mostly diverse and unique, or are you adding something like the following?
mon_price, tue_price, wed_price, ..., mon_qty, tue_qty, ...
EDIT (in response to confirmation by OP):
If it's anything like what I depict above, that's definitely a bad idea. In the case of my example, normalise the schema by creating a subtable with columns parent_id, day_of_week, price, qty
.
Large number of columns definitely results in reduced space requirements ( as other fields are not duplicated ). I have a use case where I am thinking of having 120 columns where 93=31*3 columns are used to store 3 distinct daily metrics. I would like to know if there are any specifc performance issues with this approach ( compared to having a 3 columns and a separate column as day-of-month )
精彩评论