MySQL Forums
Forum List  »  Optimizer & Parser

Aggregate function optimization for same column in same record
Posted by: Nathan Alden
Date: October 07, 2007 10:30PM

If I perform an aggregate function on a particular column more than once per record in a grouped result set, is the aggregate function processed separately each time or does MySQL recognize that the result of the function should be the same in each case?

My actual SQL is more complicated than the following, but it does demonstrate the question:

select sum(column1), sum(column1)
from table1

Is sum() actually calculated twice or does MySQL realize the value should be the same and used a "cached" value instead for subsequent calls?

Thanks all.

Options: ReplyQuote


Subject
Views
Written By
Posted
Aggregate function optimization for same column in same record
3982
October 07, 2007 10:30PM


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.