List:General Discussion« Previous MessageNext Message »
From:Jangita Date:September 3 2010 10:17am
Subject:Re: Best method to keep totals
View as plain text  
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: jangita@stripped
Skype: jangita | GTalk: jangita.nyagudi@stripped
Thread
Best method to keep totalsTompkins Neil1 Sep
  • RE: Best method to keep totalsJerry Schwartz1 Sep
    • Re: Best method to keep totalsTompkins Neil1 Sep
  • Re: Best method to keep totalsJangita3 Sep
    • Re: Best method to keep totalsArthur Fuller3 Sep
      • Re: Best method to keep totalsMark Goodge3 Sep
        • Re: Best method to keep totalsArthur Fuller4 Sep
          • Re: Best method to keep totalsNeil Tompkins5 Sep
            • Re: Best method to keep totalsTompkins Neil6 Sep
RE: Best method to keep totalsJan Steinman2 Sep
  • RE: Best method to keep totalsJerry Schwartz2 Sep
    • Re: Best method to keep totalsJan Steinman3 Sep