PDA

View Full Version : Computed variables store or compute?


The_Walrus
04-29-2003, 08:53 PM
is it better to have values stored in your database that are computed or to compute them each time. for instance you have 50 different records with say 10 fields
you always want to list every field in the record and 1 additional one that totals fields 1-10 is it better just to have that in the database or to total when you request the data each time? I hope that is a good explanation...

Ökii
04-29-2003, 09:35 PM
it would depend upon how often the content of each row changed - if they rarely change you'd do best adding another column to store the sum - if they change every few hours or days, you might find the scripting easier to just do the math at page view.