mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-02 10:40:57 +08:00
Updated range and defaults for iterative search parameters
This commit is contained in:
@@ -177,9 +177,9 @@ HINT: Available values: off, relaxed_order, strict_order.
|
||||
SHOW hnsw.max_search_tuples;
|
||||
hnsw.max_search_tuples
|
||||
------------------------
|
||||
-1
|
||||
20000
|
||||
(1 row)
|
||||
|
||||
SET hnsw.max_search_tuples = -2;
|
||||
ERROR: -2 is outside the valid range for parameter "hnsw.max_search_tuples" (-1 .. 2147483647)
|
||||
SET hnsw.max_search_tuples = 0;
|
||||
ERROR: 0 is outside the valid range for parameter "hnsw.max_search_tuples" (1 .. 2147483647)
|
||||
DROP TABLE t;
|
||||
|
||||
@@ -95,13 +95,6 @@ SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
[0,0,0]
|
||||
(3 rows)
|
||||
|
||||
SET ivfflat.max_probes = 0;
|
||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
val
|
||||
---------
|
||||
[1,2,3]
|
||||
(1 row)
|
||||
|
||||
SET ivfflat.max_probes = 1;
|
||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
val
|
||||
@@ -163,11 +156,11 @@ HINT: Available values: off, relaxed_order.
|
||||
SHOW ivfflat.max_probes;
|
||||
ivfflat.max_probes
|
||||
--------------------
|
||||
-1
|
||||
32768
|
||||
(1 row)
|
||||
|
||||
SET ivfflat.max_probes = -2;
|
||||
ERROR: -2 is outside the valid range for parameter "ivfflat.max_probes" (-1 .. 32768)
|
||||
SET ivfflat.max_probes = 0;
|
||||
ERROR: 0 is outside the valid range for parameter "ivfflat.max_probes" (1 .. 32768)
|
||||
SET ivfflat.max_probes = 32769;
|
||||
ERROR: 32769 is outside the valid range for parameter "ivfflat.max_probes" (-1 .. 32768)
|
||||
ERROR: 32769 is outside the valid range for parameter "ivfflat.max_probes" (1 .. 32768)
|
||||
DROP TABLE t;
|
||||
|
||||
@@ -104,6 +104,6 @@ SET hnsw.iterative_search = on;
|
||||
|
||||
SHOW hnsw.max_search_tuples;
|
||||
|
||||
SET hnsw.max_search_tuples = -2;
|
||||
SET hnsw.max_search_tuples = 0;
|
||||
|
||||
DROP TABLE t;
|
||||
|
||||
@@ -53,9 +53,6 @@ CREATE INDEX ON t USING ivfflat (val vector_l2_ops) WITH (lists = 3);
|
||||
SET ivfflat.iterative_search = relaxed_order;
|
||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
|
||||
SET ivfflat.max_probes = 0;
|
||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
|
||||
SET ivfflat.max_probes = 1;
|
||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||
|
||||
@@ -93,7 +90,7 @@ SET ivfflat.iterative_search = on;
|
||||
|
||||
SHOW ivfflat.max_probes;
|
||||
|
||||
SET ivfflat.max_probes = -2;
|
||||
SET ivfflat.max_probes = 0;
|
||||
SET ivfflat.max_probes = 32769;
|
||||
|
||||
DROP TABLE t;
|
||||
|
||||
@@ -27,6 +27,7 @@ $node->safe_psql("postgres", qq(
|
||||
my $count = $node->safe_psql("postgres", qq(
|
||||
SET enable_seqscan = off;
|
||||
SET hnsw.iterative_search = relaxed_order;
|
||||
SET hnsw.max_search_tuples = 100000;
|
||||
SET work_mem = '8MB';
|
||||
SELECT COUNT(*) FROM (SELECT v FROM tst WHERE i % 10000 = 0 ORDER BY v <-> (SELECT v FROM tst LIMIT 1) LIMIT 11) t;
|
||||
));
|
||||
@@ -59,7 +60,7 @@ my ($ret, $stdout, $stderr) = $node->psql("postgres", qq(
|
||||
SET enable_seqscan = off;
|
||||
SET hnsw.iterative_search = relaxed_order;
|
||||
SET client_min_messages = debug1;
|
||||
SET work_mem = '2MB';
|
||||
SET work_mem = '1MB';
|
||||
SELECT COUNT(*) FROM (SELECT v FROM tst WHERE i % 10000 = 0 ORDER BY v <-> (SELECT v FROM tst LIMIT 1) LIMIT 11) t;
|
||||
));
|
||||
like($stderr, qr/hnsw index scan exceeded work_mem after \d+ tuples/);
|
||||
|
||||
Reference in New Issue
Block a user