Re: SELECT DISTINCT very slow

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-general(at)postgresql(dot)org, Ben Harper <rogojin(at)gmail(dot)com>
Subject: Re: SELECT DISTINCT very slow
Date: 2009-07-10 17:17:08
Message-ID: 1247246228.26589.318.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message decibel 2009-07-10 17:37:02 Re: REINDEX "is not a btree"
Previous Message Brandon Metcalf 2009-07-10 16:34:48 Re: UNION question