
Originally Posted by
jmurrayhead
I just want to add that there are exceptions to every rule. When it comes down to performance of a system, sometimes you have to store a calculated value in your table structure.
Take this forum, for instance. Thread, post, and view counts (among a few others) are all pre-calculated and stored in the table. Why?
Actually if you properly index the table, these calculations are fairly instant. The slowdown being the insert for updating the indexes, but no more of a slowdown than a separate update to update the totals with much less corruption possibilities. I've found views to be very good for this too. A lot of people complain about views because unique queries are slower, but whats brilliant about views is they are cached, so a well designed view that is being pulled by each and every user is very very light on the database and is only updated when the referenced table is changed relative to the indexes the view references (if done right).
MindStalker, January 12th, 2009 11:33 AM
Bookmarks