Re: ToDo: KNN Search should to support DISTINCT clasuse?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <kgrittn(at)mail(dot)com>
Cc: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ToDo: KNN Search should to support DISTINCT clasuse?
Date: 2012-10-25 16:56:16
Message-ID: 802.1351184176@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <kgrittn(at)mail(dot)com> writes:
> Pavel Stehule wrote:
>> 2012/10/22 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> Perhaps it would be close enough to what you want to use DISTINCT ON:
>>> contrib_regression=# explain select distinct on( t <-> 'foo') *,t <-> 'foo' from test_trgm order by t <-> 'foo' limit 10;

>> good tip - it's working

> If two or more values happen to be at exactly the same distance,
> wouldn't you just get one of them?

Yeah, that is a hazard. I'm not sure whether <->'s results are
sufficiently quantized to make that a big problem in practice.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2012-10-25 17:31:31 Extensions Documentation
Previous Message Tom Lane 2012-10-25 16:49:52 Re: [9.1] 2 bugs with extensions