Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Storing vs Calculating dataStoring vs Calculating data
Previous
 
Next
New Post
12/19/2007 8:01 PM
 

Hi,

 I'm in the process of creating a database table and was wondering if it's better to store calculated values or recalculate them each time. So for example, I am creating a table that stores articles and then a table to store the pages to the article. If a new page is added should I update the pages field in the articles table or should I calculate the number of pages for an article when it's queried?

 

Thanks,
John

 
New Post
12/20/2007 12:00 AM
 

This sounds like a general programming/database design question rather than a DNN-related question, but I think you will be better off calculating at query time in your scenario. If you have a separate pages field, you are tasked with keeping it up to date, and it's possible, just by having a separate field, that it may not stay current/accurate. Counting the number of pages is also probably a pretty inexpensive calculation.

There are times, though that storing a calculated field may be preferrable. If the calculation (or associated data retreval) is expensive, and/or it is queried often.

- Jordan

 
New Post
12/26/2007 3:51 PM
 

I would tend to agree with Jordan Widstrom. My general rule of thumb is trying to measure the amount of processing it takes to calculate the value. If the calculation is super intensive and very time consuming, personally I would calc it and store it, but if it’s a very simple operation, just perform the calculation only.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Storing vs Calculating dataStoring vs Calculating data


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out