Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-25 Thread Pavel Stehule
2012/10/25 Kevin Grittner : > Tom Lane wrote: >> "Kevin Grittner" writes: >> > Pavel Stehule wrote: >> >> 2012/10/22 Tom Lane : >> >>> Perhaps it would be close enough to what you want to use DISTINCT ON: >> >>> contrib_regression=# explain select distinct on( t <-> 'foo') *,t <-> >> >>> 'foo' fr

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-25 Thread Kevin Grittner
Tom Lane wrote: > "Kevin Grittner" writes: > > Pavel Stehule wrote: > >> 2012/10/22 Tom Lane : > >>> 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' li

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-25 Thread Tom Lane
"Kevin Grittner" writes: > Pavel Stehule wrote: >> 2012/10/22 Tom Lane : >>> 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

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-25 Thread Kevin Grittner
Pavel Stehule wrote: > 2012/10/22 Tom Lane : >> 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 value

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-23 Thread Ants Aasma
On Tue, Oct 23, 2012 at 7:25 PM, Robert Haas wrote: > through the end of the input. However, when the HashAgg node is only > implementing DISTINCT (ON), you can emit each new row as soon as you > see it, and just make the hash table entry to be certain you don't > emit it again. I think someone

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-23 Thread Robert Haas
On Mon, Oct 22, 2012 at 7:09 PM, Greg Stark wrote: > On Mon, Oct 22, 2012 at 4:57 PM, Tom Lane wrote: >> 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 ther

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Greg Stark
On Mon, Oct 22, 2012 at 4:57 PM, Tom Lane wrote: > 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. sort and uni

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Pavel Stehule
2012/10/22 Tom Lane : > Robert Haas writes: >> On Mon, Oct 22, 2012 at 11:57 AM, Tom Lane wrote: >>> 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'

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Tom Lane
Robert Haas writes: > On Mon, Oct 22, 2012 at 11:57 AM, Tom Lane wrote: >> 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 i

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Robert Haas
On Mon, Oct 22, 2012 at 11:57 AM, Tom Lane wrote: > Pavel Stehule 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

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Pavel Stehule
2012/10/22 Tom Lane : > Pavel Stehule 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 impleme

Re: [HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Tom Lane
Pavel Stehule 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: eithe

[HACKERS] ToDo: KNN Search should to support DISTINCT clasuse?

2012-10-22 Thread Pavel Stehule
Hello I should to search distinct values based on similarity postgres=# explain select nazobce, nazobce <-> 'Benešov' from obce order by nazobce <-> 'Benešov' limit 10 ; QUERY PLAN ---