Re: Add missing operator <->(box, point)

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Add missing operator <->(box, point)
Date: 2019-07-08 20:38:07
Message-ID: 9c1f39b6-7e11-fbda-d79a-3ff8a40eb1a2@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)gluhov(at)postgrespro(dot)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(dot)gluhov(at)postgrespro(dot)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 Content-Type Size
0001-Add-missing-distance-operators-v03.patch text/x-patch 95.4 KB
0002-Add-operator-box-point-to-GiST-box_ops-v03.patch text/x-patch 9.3 KB
0003-Add-operator-box-point-to-SP-GiST-box_ops-v03.patch text/x-patch 9.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2019-07-08 20:41:50 Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS)
Previous Message Alvaro Herrera 2019-07-08 20:33:03 Re: Ltree syntax improvement