pgvector.git / summary / log / commit / refs
commit 71ce9d33114fc59758b822d6d0109b3662fcab3d
Author: Andrew Kane <andrew@ankane.org>
Date: Thu Jul 02 00:18:34 2026 +0000
Added test for concurrent INSERTs, DELETEs, SELECTs, and VACUUM with IVFFlat [skip ci]
test/t/048_ivfflat_vacuum_insert.pl | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/test/t/048_ivfflat_vacuum_insert.pl b/test/t/048_ivfflat_vacuum_insert.pl
new file mode 100644
index 00000000..d518735f
--- /dev/null
+++ b/test/t/048_ivfflat_vacuum_insert.pl
@@ -0,0 +1,38 @@
+use strict;
+use warnings FATAL => 'all';
+use PostgreSQL::Test::Cluster;
+use PostgreSQL::Test::Utils;
+use Test::More;
+
+my $dim = 3;
+my $array_sql = join(",", ('random()') x $dim);
+
+# Initialize node
+my $node = PostgreSQL::Test::Cluster->new('node');
+$node->init;
+$node->start;
+
+# Create table and index
+$node->safe_psql("postgres", "CREATE EXTENSION vector;");
+$node->safe_psql("postgres", "CREATE TABLE tst (i serial, v vector($dim));");
+$node->safe_psql("postgres", "ALTER TABLE tst SET (autovacuum_enabled = false);");
+$node->safe_psql("postgres",
+ "INSERT INTO tst (v) SELECT ARRAY[$array_sql] FROM generate_series(1, 1000) i;"
+);
+$node->safe_psql("postgres", "CREATE INDEX ON tst USING ivfflat (v vector_l2_ops) WITH (lists = 10);");
+
+$node->pgbench(
+ "--no-vacuum --client=5 --transactions=1500",
+ 0,
+ [qr{actually processed}],
+ [qr{^$}],
+ "concurrent INSERTs, DELETEs, SELECTs, and VACUUM",
+ {
+ "048_ivfflat_vacuum_insert_insert\@500" => "INSERT INTO tst (v) VALUES (ARRAY[$array_sql]);",
+ "048_ivfflat_vacuum_insert_delete\@500" => "DELETE FROM tst WHERE i = (SELECT i FROM tst LIMIT 1);",
+ "048_ivfflat_vacuum_insert_select\@500" => "SELECT i FROM tst ORDER BY v <-> (SELECT ARRAY[$array_sql]::vector) LIMIT 10;",
+ "048_ivfflat_vacuum_insert_vacuum\@1" => "VACUUM tst;"
+ }
+);
+
+done_testing();
[parent: d19cc0d37192]