Re: Why are distinct and group by choosing different plans? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Why are distinct and group by choosing different plans?
Date
Msg-id 17521.1186102087@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why are distinct and group by choosing different plans?  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-performance
Gregory Stark <stark@enterprisedb.com> writes:
> I think "distinct" just doesn't know about hash aggregates yet. That's partly
> an oversight and partly of a "feature" in that it gives a convenient way to
> write a query which avoids them. I think it's also partly that "distinct" is
> trickier to fix because it's the same codepath as "distinct on" which is
> decidedly more complex than a simple "distinct".

It's not an oversight :-(.  But the DISTINCT/DISTINCT ON code is old,
crufty, and tightly entwined with ORDER BY processing.  It'd be nice to
clean it all up someday, but the effort seems a bit out of proportion
to the reward...

            regards, tom lane

pgsql-performance by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Why are distinct and group by choosing different plans?
Next
From: "Carlos H. Reimer"
Date:
Subject: RES: RES: Improving select peformance