Re: Cube extension kNN support

From: Stas Kelvich <stas(dot)kelvich(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cube extension kNN support
Date: 2015-02-07 09:45:47
Message-ID: 60A241A6-F639-4B9C-99AA-2E0F53793D34@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

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;

Stas Kelvich.

Attachment Content-Type Size
distances2.patch application/octet-stream 47.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-02-07 11:55:14 Re: relid of non user created tables
Previous Message Pavel Stehule 2015-02-07 09:26:37 Re: Providing catalog view to pg_hba.conf file - Patch submission