Page 1 of 1

Where store calculated values from several tables?

PostPosted: Tue Jul 11, 2006 6:17 am
Author: Rixn
I've got a DB with highscores from several Shockwave games. Each game has its own table with the columns Score, Name and Date. In addition I've got a table with game parameters like game name, type, score type and so on.

Now I want to keep track on statistics for the games, that is values that I get from each game that I do some calculation on. Should I store those in the additional table or should I calculate them each time I need them?

Is it possible to have a script running in the back to calculate these values and then keep storing them into the table? I fear that always calculating when I need the values would slow things down so I hope one can solve this in another way.

What do you all say about this - what should I do?

Regards
/Rixn

Re: Where store calculated values from several tables?

PostPosted: Mon Jul 17, 2006 5:39 pm
Author: Michaelo
My rule of thumbà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦
If you are going to store data to be retrieved only once and not use in some other process try the calculation method firstà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦ it should be faster than an sql queryà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦

The calculation should be done in the in the php file that send data to the associated tpl fileà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦

If you are doing several calculations (one for each game) then you should consider saving these to the databaseà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦

Mike