[thelist] Database Design Question

Judah McAuley judah at wiredotter.com
Tue Mar 1 13:59:08 CST 2005


Carolyn Jewel wrote:
> It's rarely a good idea, imho, to store the results of a calculation. If
> you need history (as in you need to know that the result of a
> calculation was X on date:time Y, then it might make sense to store the
> result in a table.
> 
> The problem with storing the result of the calculation is that you must
> either risk showing stale data or perform the calculation again anyway.
> 

In general, I like using Views for this. Grab the data that you need, 
perform the calculations that you need all in a nice presentable table 
that is easy to query. The rows in the View change automatically as the 
source table(s) change, so you don't have to worry about stale data, but 
you also simplify your queries.

Depending on your version of MySql, this may not be an option, but its 
something to look into as a general db design idea.

Judah


More information about the thelist mailing list