Re: space for optimalization: DISTINCT without index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: space for optimalization: DISTINCT without index
Date
Msg-id 2407.1134427878@sss.pgh.pa.us
Whole thread Raw
In response to Re: space for optimalization: DISTINCT without index  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
Bruno Wolff III <bruno@wolff.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


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Something I don't understand with the use of schemas
Next
From: Andreas Pflug
Date:
Subject: Re: pg_relation_size locking