Re: Cube extension kNN support - Mailing list pgsql-hackers

From Oleg Bartunov
Subject Re: Cube extension kNN support
Date
Msg-id CAF4Au4ybJ_7Kr7whJVHunWjjjyTwZYaPuLr0Ny5ZfFschc8naA@mail.gmail.com
Whole thread
In response to Cube extension kNN support  (Stas Kelvich <stas.kelvich@gmail.com>)
List pgsql-hackers
Do you have any benchmarks ?


On Mon, Sep 23, 2013 at 3:38 AM, Stas Kelvich <stas.kelvich@gmail.com> wrote:
Hello, hackers.

Here is the patch that introduces kNN search for cubes with euclidean, taxicab and chebyshev distances.

Following distance operators introduced:

<#> taxicab distance
<->  euclidean distance
<=> chebyshev distance

For example:
SELECT * FROM objects ORDER BY objects.coord <-> '(137,42,314)'::cube LIMIT 10;

Also there is operator "->" for selecting ordered rows directly from index.
This request selects rows ordered ascending by 3rd coordinate:

SELECT * FROM objects ORDER BY objects.coord->3 LIMIT 10;

For descendent ordering suggested syntax with minus before coordinate.
This request selects rows ordered descending by 4th coordinate:

SELECT * FROM objects ORDER BY objects.coord->-4 LIMIT 10;

Stas Kelvich.




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: pgbench progress report improvements - split 3
Next
From: Abhijit Menon-Sen
Date:
Subject: Re: LDAP: bugfix and deprecated OpenLDAP API