tags:

views:

15

answers:

1

Does the Optimizer evaluate the avergae only one time, or two times?

SELECT AVG(col1), 1/AVG(col1) FROM table

Thanks

+1  A: 

I wouldn't worry about it. Even if mySqueal computes it twice, it will make only one pass over the data as most aggregates are computed in one pass - and it's reading in the data that takes the time, so you want that to happen just once.

mdma