mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Improved test SQL [skip ci]
This commit is contained in:
@@ -85,7 +85,7 @@ for my $i (0 .. $#operators)
|
||||
# Handle ties
|
||||
my $res = $node->safe_psql("postgres", qq(
|
||||
WITH top AS (
|
||||
SELECT v $operator $_ AS distance FROM tst ORDER BY v $operator $_ LIMIT $limit
|
||||
SELECT v $operator $_ AS distance FROM tst ORDER BY distance LIMIT $limit
|
||||
)
|
||||
SELECT i FROM tst WHERE (v $operator $_) <= (SELECT MAX(distance) FROM top)
|
||||
));
|
||||
|
||||
@@ -98,7 +98,7 @@ for my $i (0 .. $#operators)
|
||||
my $res = $node->safe_psql("postgres", qq(
|
||||
SET enable_indexscan = off;
|
||||
WITH top AS (
|
||||
SELECT v $operator $_ AS distance FROM tst ORDER BY v $operator $_ LIMIT $limit
|
||||
SELECT v $operator $_ AS distance FROM tst ORDER BY distance LIMIT $limit
|
||||
)
|
||||
SELECT i FROM tst WHERE (v $operator $_) <= (SELECT MAX(distance) FROM top)
|
||||
));
|
||||
|
||||
@@ -83,7 +83,7 @@ foreach (@queries)
|
||||
my $res = $node->safe_psql("postgres", qq(
|
||||
SET enable_indexscan = off;
|
||||
WITH top AS (
|
||||
SELECT v <~> $_ AS distance FROM tst ORDER BY v <~> $_ LIMIT $limit
|
||||
SELECT v <~> $_ AS distance FROM tst ORDER BY distance LIMIT $limit
|
||||
)
|
||||
SELECT i FROM tst WHERE (v <~> $_) <= (SELECT MAX(distance) FROM top)
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user