Re: Optimization of unnecessary GROUP BY columns - Mailing list pgsql-general

From Tom Lane
Subject Re: Optimization of unnecessary GROUP BY columns
Date
Msg-id 27344.1167161817@sss.pgh.pa.us
Whole thread Raw
In response to Re: Optimization of unnecessary GROUP BY columns  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Tue, Dec 26, 2006 at 12:08:04PM -0500, Kevin Murphy wrote:
>> When columns are required in a GROUP BY clause even though some of them
>> are fully dependent on others, is there any plan for making it possible
>> to do the GROUP BY only on the necessary columns?

> Recent SQL standards require it, so it's likely to be implemented at
> some point.

This optimization is in the nature of depending on a constraint (ie, a
PRIMARY KEY) for plan correctness, so I'm hesitant to think about doing
it before we have plan invalidation implemented.  Actually it's even
worse than that: it's in the nature of depending on a constraint for
*query* correctness.  If you ALTER DROP PRIMARY KEY then your query is
now illegal, and we really oughta notice that ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Melvin Davidson"
Date:
Subject: Functions to obtain group members- PostgreSQL prior to 8.1
Next
From: postgresql.org@tgice.com
Date:
Subject: Re: Problem with index in OR'd expression