Re: Why does adding SUM and GROUP BY destroy performance? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why does adding SUM and GROUP BY destroy performance?
Date
Msg-id 18770.1063983015@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why does adding SUM and GROUP BY destroy performance?  (Ang Chin Han <angch@bytecraft.com.my>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: DDL diff utility?
Next
From: "Marc G. Fournier"
Date:
Subject: Re: State of Beta 2