Re: Optimization of unnecessary GROUP BY columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: Optimization of unnecessary GROUP BY columns
Date: 2006-12-26 19:36:57
Message-ID: 27344.1167161817@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message postgresql.org 2006-12-26 21:12:36 Re: Problem with index in OR'd expression
Previous Message Melvin Davidson 2006-12-26 17:58:28 Functions to obtain group members- PostgreSQL prior to 8.1