MySQL Forums
Forum List  »  PHP

Re: Running Total
Posted by: Peter Brawley
Date: April 15, 2007 04:32PM

Usually the turnaround time of a small aggregate query, eg "SELECT SUM(credit) - SUM(debit) AS balance FROM tbl WHERE id=$id", is a small fraction of the total turnaround time of sending a query to the server, retrieving the result, and repainting the client page, so the small performance gain you might enjoy from storing such balances is likely to be more than offset by the time it takes to update such aggregate values whenever one of their constituent items changes. So the usual rule, except in OLAP, is not to store what can be computed easily.

Options: ReplyQuote

Written By
April 15, 2007 04:04PM
Re: Running Total
April 15, 2007 04:32PM
April 15, 2007 08:33PM
April 15, 2007 09:08PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.