Re: space for optimalization: DISTINCT without index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: space for optimalization: DISTINCT without index
Date: 2005-12-12 22:51:18
Message-ID: 2407.1134427878@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> DISTINCT will require a sort step to remove duplicates. GROUP BY can use
> either a sort or hash aggregate plan. If there are few distinct values,
> the hash aggregate plan can be much faster.

The DISTINCT code hasn't been revisited in a long time. One obstacle to
improving it is that it's very tightly intertwined with ORDER BY. While
fixing that might be just a Small Matter Of Programming, it's not clear
how to decouple them without breaking DISTINCT ON.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Racine 2005-12-12 22:57:35 GUI Debugger for PostgreSQL on Windows
Previous Message Jim C. Nasby 2005-12-12 22:49:52 Re: Something I don't understand with the use of schemas