From c9875f5150ebb19673a8594b4723dd19d03183c1 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 5 Jan 2026 12:42:14 -0800 Subject: [PATCH] Simplified test case - resolves #943 --- test/t/005_ivfflat_query_recall.pl | 32 ++++++++++-------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/test/t/005_ivfflat_query_recall.pl b/test/t/005_ivfflat_query_recall.pl index 714e3a2..814904b 100644 --- a/test/t/005_ivfflat_query_recall.pl +++ b/test/t/005_ivfflat_query_recall.pl @@ -16,29 +16,19 @@ $node->safe_psql("postgres", "INSERT INTO tst SELECT i, ARRAY[random(), random(), random()] FROM generate_series(1, 100000) i;" ); -# Check each index type -my @operators = ("<->", "<#>", "<=>"); -my @opclasses = ("vector_l2_ops", "vector_ip_ops", "vector_cosine_ops"); +# Add index +$node->safe_psql("postgres", "CREATE INDEX ON tst USING ivfflat (v vector_l2_ops);"); -for my $i (0 .. $#operators) +# Test 100% recall +for (1 .. 20) { - my $operator = $operators[$i]; - my $opclass = $opclasses[$i]; - - # Add index - $node->safe_psql("postgres", "CREATE INDEX ON tst USING ivfflat (v $opclass);"); - - # Test 100% recall - for (1 .. 20) - { - my $id = int(rand() * 100000); - my $query = $node->safe_psql("postgres", "SELECT v FROM tst WHERE i = $id;"); - my $res = $node->safe_psql("postgres", qq( - SET enable_seqscan = off; - SELECT v FROM tst ORDER BY v <-> '$query' LIMIT 1; - )); - is($res, $query); - } + my $id = int(rand() * 100000); + my $query = $node->safe_psql("postgres", "SELECT v FROM tst WHERE i = $id;"); + my $res = $node->safe_psql("postgres", qq( + SET enable_seqscan = off; + SELECT v FROM tst ORDER BY v <-> '$query' LIMIT 1; + )); + is($res, $query); } done_testing();