[thelist] Database Design Question

Joshua Olson joshua at waetech.com
Mon Feb 28 08:23:35 CST 2005


> -----Original Message-----
> From: Burhan Khalid
> Sent: Monday, February 28, 2005 6:01 AM
> 
>    The site runs like this.  Users purchase space (like 
> 20MB).  They can 
> then add files to this space.  Once they download a file, the 
> filesize 
> in reduced from their available space.
> 
>    I'm wondering if its better to store this remaining 
> balance value in 
> the database, or calculate it on the fly whenever it needs to be 
> displayed?  

Burhan,

This is a classic OLAP vs OLTP problem.  Personally, I'd lean towards
calculating it on the fly as necessary so that the same information doesn't
appear in the database in two different forms.  With proper indexes you
should be able to calculate the aggregates very quickly for individual
users.  If there are a massive number of records per user, then this system
will eventually bloat.  Is that a likely scenario?  Remember, often times a
90% solution done in 10% of the time is better than a 100% solution.
Consider real-world cases before over-engineering a database.  Simplicity of
design is often far more valuable in the long-run than trying to squeeze
every last cycle out of the CPU.  Consider maintenance over elegance. ...
blah, blah blah...  :-)

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the thelist mailing list