Re: Add missing operator <->(box, point) - Mailing list pgsql-hackers

From Nikita Glukhov
Subject Re: Add missing operator <->(box, point)
Date
Msg-id 9c1f39b6-7e11-fbda-d79a-3ff8a40eb1a2@postgrespro.ru
Whole thread Raw
In response to Re: Add missing operator <->(box, point)  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Responses Re: Add missing operator <->(box, point)  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
List pgsql-hackers
Attached 3rd version of the patches.

On 02.07.2019 21:55, Alexander Korotkov wrote:
On Tue, Jul 2, 2019 at 9:19 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:
We could use commuted "const <-> var" operators for kNN searches, but the
current implementation requires the existence of "var <-> const" operators, and
order-by-op clauses are rebuilt using them (see match_clause_to_ordering_op()
at /src/backend/optimizer/path/indxpath.c).
But probably it's still worth to just add commutator for every <->
operator and close this question.  Otherwise, it may arise again once
we want to add some more kNN support to opclasses or something.  On
the other hand, are we already going to limit oid consumption?
All missing distance operators were added to the first patch.


On 08.07.2019 18:22, Alexander Korotkov wrote:
On Mon, Mar 11, 2019 at 2:49 AM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:
2. Add <-> to GiST box_ops.  Extracted gist_box_distance_helper() common for gist_box_distance() and  gist_bbox_distance().
For me it doesn't look worth having two distinct functions
gist_box_distance_helper() and gist_bbox_distance().  What about
having just one and leave responsibility for recheck flag to the
caller?
gist_bbox_distance() was removed. 

But maybe it would be better to replace two identical functions 
gist_circle_distance() and gist_poly_distance() with the single 
gist_bbox_distance()?


3. Add <-> to SP-GiST.  Changed only catalog and tests.  Box case is already checked in  spg_box_quad_leaf_consistent():    out->recheckDistances = distfnoid == F_DIST_POLYP;
So, it seems to be fix of oversight in 2a6368343ff4.  But assuming
fixing this requires catalog changes, we shouldn't backpatch this.

-- 
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Ltree syntax improvement
Next
From: Bruce Momjian
Date:
Subject: Re: [Proposal] Table-level Transparent Data Encryption (TDE) and KeyManagement Service (KMS)