summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/index-only-scan.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/test/isolation/specs/index-only-scan.spec
parentInitial commit. (diff)
downloadpostgresql-14-upstream.tar.xz
postgresql-14-upstream.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/index-only-scan.spec')
-rw-r--r--src/test/isolation/specs/index-only-scan.spec46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/isolation/specs/index-only-scan.spec b/src/test/isolation/specs/index-only-scan.spec
new file mode 100644
index 0000000..4e4171c
--- /dev/null
+++ b/src/test/isolation/specs/index-only-scan.spec
@@ -0,0 +1,46 @@
+# index-only scan test
+#
+# This test tries to expose problems with the interaction between index-only
+# scans and SSI.
+#
+# Any overlap between the transactions must cause a serialization failure.
+
+setup
+{
+ CREATE TABLE tabx (id int NOT NULL);
+ INSERT INTO tabx SELECT generate_series(1,10000);
+ ALTER TABLE tabx ADD PRIMARY KEY (id);
+ CREATE TABLE taby (id int NOT NULL);
+ INSERT INTO taby SELECT generate_series(1,10000);
+ ALTER TABLE taby ADD PRIMARY KEY (id);
+}
+setup { VACUUM FREEZE ANALYZE tabx; }
+setup { VACUUM FREEZE ANALYZE taby; }
+
+teardown
+{
+ DROP TABLE tabx;
+ DROP TABLE taby;
+}
+
+session s1
+setup
+{
+ BEGIN ISOLATION LEVEL SERIALIZABLE;
+ SET LOCAL seq_page_cost = 0.1;
+ SET LOCAL random_page_cost = 0.1;
+ SET LOCAL cpu_tuple_cost = 0.03;
+}
+step rxwy1 { DELETE FROM taby WHERE id = (SELECT min(id) FROM tabx); }
+step c1 { COMMIT; }
+
+session s2
+setup
+{
+ BEGIN ISOLATION LEVEL SERIALIZABLE;
+ SET LOCAL seq_page_cost = 0.1;
+ SET LOCAL random_page_cost = 0.1;
+ SET LOCAL cpu_tuple_cost = 0.03;
+}
+step rywx2 { DELETE FROM tabx WHERE id = (SELECT min(id) FROM taby); }
+step c2 { COMMIT; }