On 01/09/2010 10:29 p, Tompkins Neil wrote:
Hi,

I'm developing a system whereby a manager gets assigned points based a
certain number of factors which are saved alongside a football result.
  However, I also want to keep a total for each manager.  My question is it
best to just have a query that uses SUM to total the managers points gained
for each fixture participated in ?  Or should I be looking to have
a separate field which is the calculated total for each manager ?

Thanks in advance for any advice.

Cheers
Neil

Neil, its generally not a good idea to store totals. I also had that problem when i thought that as data grows it will slow down the server to a halt. We have a mobile financial system with a table called trns that stores all the credits and debits per account. each time a customer wants his balance we sum up all the debits and credits (debits being negative) and reply with the answer. We have close to 1 million million people and each person does around 2 transactions per month, so the trn table grows 2 million records every month we are in our 3rd month. and select sum(t_amount) from trn where t_acno = xxxx works like a charm! of course t_acno is indexed and the server is optimized.

In addition we sum before a debit to see if the balance is suffecient, before a transfer, blah blah blah ...

So it's all good.

--
Jangita | +256 76 91 8383 | Y! & MSN: jang...@yahoo.com
Skype: jangita | GTalk: jangita.nyag...@gmail.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to