Martijn van Oosterhout <kleptog@xxxxxxxxx> 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