From 40c49a29ef6b55973ccf98290f103f9649b0c532 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 13 Feb 2024 21:51:35 -0800 Subject: [PATCH] Improved test [skip ci] --- test/t/020_hnsw_filtering.pl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/t/020_hnsw_filtering.pl b/test/t/020_hnsw_filtering.pl index cf556f7..d6f95aa 100644 --- a/test/t/020_hnsw_filtering.pl +++ b/test/t/020_hnsw_filtering.pl @@ -95,12 +95,15 @@ for my $i (0 .. $#queries) # Test recall test_recall(0.99, '<->'); -# Test vacuum -$node->safe_psql("postgres", "DELETE FROM tst WHERE c > '5';"); -$node->safe_psql("postgres", "VACUUM tst;"); +# Test no conditions +my $explain = $node->safe_psql("postgres", qq( + SET enable_seqscan = off; + EXPLAIN ANALYZE SELECT i FROM tst ORDER BY v <-> '$queries[0]' LIMIT $limit; +)); +like($explain, qr/Index Scan/); # Test multiple conditions -my $explain = $node->safe_psql("postgres", qq( +$explain = $node->safe_psql("postgres", qq( SET enable_seqscan = off; EXPLAIN ANALYZE SELECT i FROM tst WHERE c = '$cs[0]' AND c2 = '$cs[0]' ORDER BY v <-> '$queries[0]' LIMIT $limit; )); @@ -113,6 +116,10 @@ $explain = $node->safe_psql("postgres", qq( )); like($explain, qr/Seq Scan/); +# Test vacuum +$node->safe_psql("postgres", "DELETE FROM tst WHERE c > '5';"); +$node->safe_psql("postgres", "VACUUM tst;"); + # Test columns my ($ret, $stdout, $stderr) = $node->psql("postgres", "CREATE INDEX ON tst USING hnsw (c);"); like($stderr, qr/first column must be a vector/);