Re: Postgres Planner Bug - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Postgres Planner Bug
Date
Msg-id 18587.1033447235@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgres Planner Bug  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> The patch below 'fixes' this (and possibly breaks everything else). I
>> haven't tested it rigorously and it *just* special cases group by
>> clauses with functions in them.

Surely this cure is worse than the disease.

The general problem is that we don't attempt to match
arbitrary-expression GROUP BY clauses against arbitrary subexpressions
of sub-SELECTs.  While that could certainly be done, I'm concerned about
the cycles that we'd expend trying to match everything against
everything else.  This would be an exponential cost imposed on every
group-by-with-subselect query whether it needed the feature or not.

Given that GROUP BY is restricted to a simple column reference in both
SQL92 and SQL99, is it worth a large performance hit on unrelated
queries to support this feature?  What other DBs support it?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: Postgres Planner Bug
Next
From: Karel Zak
Date:
Subject: Re: Postgresql likes Tuesday...