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

From Alexander Korotkov
Subject Re: Cube extension kNN support
Date
Msg-id CAPpHfdugQB1iiLCO+=BRhP5R5-DhumsZaZwKRtYNcq58UKTVpA@mail.gmail.com
Whole thread Raw
In response to Re: Cube extension kNN support  (Stas Kelvich <stas.kelvich@gmail.com>)
Responses Re: Cube extension kNN support
List pgsql-hackers
Hi!

On Sat, Feb 7, 2015 at 12:45 PM, Stas Kelvich <stas.kelvich@gmail.com> wrote:
I had updated old patch with kNN operators for cube data structures. Copying description from old message:

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;

I've checked the patch. The first notes are so:
1) Check coding style, in particular braces. Postgres coding style require using it for multiline statements.
2) Update documentation according to new features.

------
With best regards,
Alexander Korotkov.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Parallel Seq Scan
Next
From: Tom Lane
Date:
Subject: Re: perplexing error message