mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-14 00:26:55 +08:00
Added distance filters to cost tests [skip ci]
This commit is contained in:
@@ -17,7 +17,7 @@ $node->safe_psql("postgres", "CREATE EXTENSION vector;");
|
|||||||
for my $dim (@dims)
|
for my $dim (@dims)
|
||||||
{
|
{
|
||||||
my $array_sql = join(",", ('random()') x $dim);
|
my $array_sql = join(",", ('random()') x $dim);
|
||||||
my $n = $dim == 384 ? 2000 : 1000;
|
my $n = $dim == 384 ? 3000 : 1000;
|
||||||
|
|
||||||
# Create table and index
|
# Create table and index
|
||||||
$node->safe_psql("postgres", "CREATE TABLE tst (i int4, v vector($dim));");
|
$node->safe_psql("postgres", "CREATE TABLE tst (i int4, v vector($dim));");
|
||||||
@@ -40,6 +40,11 @@ for my $dim (@dims)
|
|||||||
));
|
));
|
||||||
like($explain, qr/Index Scan using idx/);
|
like($explain, qr/Index Scan using idx/);
|
||||||
|
|
||||||
|
$explain = $node->safe_psql("postgres", qq(
|
||||||
|
EXPLAIN ANALYZE SELECT i FROM tst WHERE v <-> '$query' < 1 ORDER BY v <-> '$query' LIMIT $limit;
|
||||||
|
));
|
||||||
|
like($explain, qr/Index Scan using idx/);
|
||||||
|
|
||||||
$node->safe_psql("postgres", "DROP TABLE tst;");
|
$node->safe_psql("postgres", "DROP TABLE tst;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ for my $dim (@dims)
|
|||||||
));
|
));
|
||||||
like($explain, qr/Index Scan using idx/);
|
like($explain, qr/Index Scan using idx/);
|
||||||
|
|
||||||
|
$explain = $node->safe_psql("postgres", qq(
|
||||||
|
EXPLAIN ANALYZE SELECT i FROM tst WHERE v <-> '$query' < 1 ORDER BY v <-> '$query' LIMIT $limit;
|
||||||
|
));
|
||||||
|
like($explain, qr/Index Scan using idx/);
|
||||||
|
|
||||||
$node->safe_psql("postgres", "DROP TABLE tst;");
|
$node->safe_psql("postgres", "DROP TABLE tst;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user