Enabled iterative index scans by default for HNSW [skip ci]

This commit is contained in:
Andrew Kane committed 2026-12-03 22:55:40 -08:00
1 parent d123eb67dd
commit 934f5cd5a0
8 files changed
+9 -4

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
## 0.9.0 (unreleased)
## 1.0.0 (unreleased)
- Enabled iterative index scans by default for HNSW
- Added asynchronous I/O for indexes
- Added vacuuming progress for indexes
- Added `vector_dims` function for `sparsevec`
+1 -1
View File
@@ -106,7 +106,7 @@ HnswInit(void)
DefineCustomEnumVariable("hnsw.iterative_scan", "Sets the mode for iterative scans",
NULL, &hnsw_iterative_scan,
HNSW_ITERATIVE_SCAN_OFF, hnsw_iterative_scan_options, PGC_USERSET, GUC_EXPLAIN, NULL, NULL, NULL);
HNSW_ITERATIVE_SCAN_STRICT, hnsw_iterative_scan_options, PGC_USERSET, GUC_EXPLAIN, NULL, NULL, NULL);
/* This is approximate and does not affect the initial scan */
DefineCustomIntVariable("hnsw.max_scan_tuples", "Sets the max number of tuples to visit for iterative scans",
+1 -1
View File
@@ -184,7 +184,7 @@ ERROR: 1001 is outside the valid range for parameter "hnsw.ef_search" (1 .. 100
SHOW hnsw.iterative_scan;
hnsw.iterative_scan
---------------------
off
strict_order
(1 row)
SET hnsw.iterative_scan = on;
+1
View File
@@ -26,6 +26,7 @@ sub test_duplicates
my $res = $node->safe_psql("postgres", qq(
SET enable_seqscan = off;
SET hnsw.ef_search = 1;
SET hnsw.iterative_scan = off;
SELECT COUNT(*) FROM (SELECT * FROM tst ORDER BY v <-> '[1,1,1]') t;
));
is($res, 10);
+1
View File
@@ -26,6 +26,7 @@ sub test_duplicates
my $res = $node->safe_psql("postgres", qq(
SET enable_seqscan = off;
SET hnsw.ef_search = 1;
SET hnsw.iterative_scan = off;
SELECT COUNT(*) FROM (SELECT * FROM tst ORDER BY v <~> '111') t;
));
is($res, 10);
+1
View File
@@ -26,6 +26,7 @@ sub test_duplicates
my $res = $node->safe_psql("postgres", qq(
SET enable_seqscan = off;
SET hnsw.ef_search = 1;
SET hnsw.iterative_scan = off;
SELECT COUNT(*) FROM (SELECT * FROM tst ORDER BY v <-> '[1,1,1]') t;
));
is($res, 10);
+1
View File
@@ -26,6 +26,7 @@ sub test_duplicates
my $res = $node->safe_psql("postgres", qq(
SET enable_seqscan = off;
SET hnsw.ef_search = 1;
SET hnsw.iterative_scan = off;
SELECT COUNT(*) FROM (SELECT * FROM tst ORDER BY v <-> '{1:1,2:1,3:1}/3') t;
));
is($res, 10);
+1 -1
View File
@@ -30,7 +30,7 @@ $node->pgbench(
[qr{^$}],
"concurrent SELECTs and VACUUM",
{
"046_hnsw_vacuum_scan_select\@1000" => "SET hnsw.iterative_scan = strict_order; SELECT i FROM tst ORDER BY v <-> '[0,0,0]' LIMIT 10;",
"046_hnsw_vacuum_scan_select\@1000" => "SELECT i FROM tst ORDER BY v <-> '[0,0,0]' LIMIT 10;",
"046_hnsw_vacuum_scan_vacuum\@1" => "VACUUM tst;"
}
);