Re: ToDo: KNN Search should to support DISTINCT clasuse? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: ToDo: KNN Search should to support DISTINCT clasuse?
Date
Msg-id CA+TgmoaOPohnaZSREZKHYBitE0_4eX2NZduGQGRHyxnNq2AL8Q@mail.gmail.com
Whole thread Raw
In response to Re: ToDo: KNN Search should to support DISTINCT clasuse?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ToDo: KNN Search should to support DISTINCT clasuse?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Oct 22, 2012 at 11:57 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
>> but using DISTINCT breaks KNN searching optimization
>
>> postgres=# explain select distinct nazobce, nazobce <-> 'Benešov' from
>> obce order by nazobce <-> 'Benešov' limit 10
>
> Don't hold your breath.  There are two ways the system could implement
> the DISTINCT clause: either sort and uniq, or hashaggregate.
> hashaggregate will destroy any input ordering, so there's no value in
> using the index as input.

Isn't that an implementation limitation though, rather than a
fundamental limitation?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Database object names and libpq in UTF-8 locale on Windows
Next
From: Robert Haas
Date:
Subject: Re: [v9.3] Row-Level Security