开发者

What are the trade-offs when denormalizing for a computed column?

I hope I am not asking a too obvious question here.

For my current project I am designing a relatively simple database using sql server 2008. For one of the tables I have decided to introduce a 'Computed Column' (not persisted). Its expression is simply the product of 2 other numeric columns and its sole reason for existence is convenience (I am doing some one-way databindin开发者_JS百科g to a webpage).

I realized however that using a computed column violates the first normal form. This got me wondering: Wat are the trade-offs? If my only reason for the computed column is convenience, does it outweigh the denormalization?


"using a computed column violates the first normal form": not at all ! It's not stored, it is re-calculated with the latest data at all time. So it is an excellent solution, just like having a calculated column in a view.


Its expression is simply the product of 2 other numeric columns and its sole reason for existence is convenience (I am doing some one-way databinding to a webpage).

Then put the calculation in your SELECT statement, not into the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜