Ang Chin Han <angch@bytecraft.com.my> writes:
> Christopher Browne wrote:
>> When you use SUM (or other aggregates), there are no short cuts to
>> walking through each and every tuple specified by the WHERE clause.
> Er... not in this case, if I read David's email correctly.
> His first query is walking through every tuple anyway.
No, it isn't, because he had a LIMIT. I think the real point is that
computing the first fifty groups requires sucking in a lot more tuples
than just computing the first fifty rows.
regards, tom lane