Re: SELECT DISTINCT very slow - Mailing list pgsql-general

From Jeff Davis
Subject Re: SELECT DISTINCT very slow
Date
Msg-id 1247246228.26589.318.camel@monkey-cat.sm.truviso.com
Whole thread Raw
In response to Re: SELECT DISTINCT very slow  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
On Fri, 2009-07-10 at 01:36 +0100, Greg Stark wrote:
> Arguably the missing feature here is skip-scans where we scan the
> index but only pull out one record for each distinct value. I'm not
> sure there's anything particularly stopping Postgres from being able
> to do them, but it might be a lot of code for a narrow use case.

Hypothetically, would something like a "sort distinct" operator be of
any use? I wonder how much work it would save if the sort could save
steps by weeding out duplicate tuples while sorting. That might make
sort into a better plan in cases where don't have a good estimate of the
distinct values.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Brandon Metcalf
Date:
Subject: Re: UNION question
Next
From: Jeff Davis
Date:
Subject: Re: Overhead of union versus union all