Re: [PATCH] kNN for btree

From: "Anton A(dot) Melnikov" <a(dot)melnikov(at)postgrespro(dot)ru>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, 'Alvaro Herrera' <alvherre(at)alvh(dot)no-ip(dot)org>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] kNN for btree
Date: 2024-07-31 04:46:18
Message-ID: 47adb0b0-6e65-4b40-8d93-20dcecc21395@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

Rebased existing patch on current master to have an actual working version.
There is an inconsistency with commit 5bf748b86.

Reproduction:
CREATE TABLE test (a int4);
INSERT INTO test VALUES (2), (3);
CREATE INDEX test_idx ON test USING btree(a);
SET enable_seqscan = OFF;
SELECT * FROM test WHERE a IN (2, 3) ORDER BY a <-> 5;

Actual result:
postgres=# SELECT * FROM test WHERE a IN (2, 3) ORDER BY a <-> 5;
a
---
3
(1 row)

Correct expected result:
postgres=# SELECT * FROM test WHERE a IN (2, 3) ORDER BY a <-> 5;
a
---
3
2
(2 rows)

Reported an issue in the thread corresponding to commit 5bf748b86.

With the best regards,

--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
v19_0001-Introduce-IndexAmRoutine.ammorderbyopfirstcol.patch text/x-patch 9.1 KB
v19_0002-Allow-ordering-by-operator-in-ordered-indexes.patch text/x-patch 4.7 KB
v19_0003-Extract-BTScanState-from-BTScanOpaqueData.patch text/x-patch 49.8 KB
v19_0004-Move-scalar-distance-operators-from-btree_gist-to-co.patch text/x-patch 94.3 KB
v19_0005-Add-knn-support-to-btree-indexes.patch text/x-patch 131.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton A. Melnikov 2024-07-31 04:47:33 Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan
Previous Message Peter Eisentraut 2024-07-31 04:37:09 Re: Build with LTO / -flto on macOS