From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Ron Mayer <rm_pg@cheapcomplexdevices.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Why are distinct and group by choosing different plans?
Date: Thu, 02 Aug 2007 20:48:07 -0400
Message-ID: <17521.1186102087@sss.pgh.pa.us> (raw)
In-Reply-To: <87r6mlef60.fsf@oxford.xeocode.com>
References: <f8tigg$4b6$1@news.hub.org>
<87r6mlef60.fsf@oxford.xeocode.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, stark@enterprisedb.com, rm_pg@cheapcomplexdevices.com
Subject: Re: Why are distinct and group by choosing different plans?
In-Reply-To: <17521.1186102087@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox