Commit 4a8bc39b authored by Tom Lane's avatar Tom Lane

Speed up hash_index regression test.

Commit f5ab0a14 made this test take substantially longer than it used
to.  With a bit more care, we can get the runtime back down while
achieving the same, or even a bit better, code coverage.

Mithun Cy

Discussion: https://postgr.es/m/CAD__Ouh-qaEb+rD7Uy-4g3xQYOrhPzHs-a_TrFAjiQ5azAW5+w@mail.gmail.com
parent 16ebab68
...@@ -200,9 +200,9 @@ SELECT h.seqno AS f20000 ...@@ -200,9 +200,9 @@ SELECT h.seqno AS f20000
-- Cause some overflow insert and splits. -- Cause some overflow insert and splits.
-- --
CREATE TABLE hash_split_heap (keycol INT); CREATE TABLE hash_split_heap (keycol INT);
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a;
CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol); CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol);
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 70000) a; INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a;
VACUUM FULL hash_split_heap;
-- Let's do a backward scan. -- Let's do a backward scan.
BEGIN; BEGIN;
SET enable_seqscan = OFF; SET enable_seqscan = OFF;
...@@ -213,11 +213,10 @@ MOVE BACKWARD 10000 FROM c; ...@@ -213,11 +213,10 @@ MOVE BACKWARD 10000 FROM c;
MOVE BACKWARD ALL FROM c; MOVE BACKWARD ALL FROM c;
CLOSE c; CLOSE c;
END; END;
-- DELETE, INSERT, REBUILD INDEX. -- DELETE, INSERT, VACUUM.
DELETE FROM hash_split_heap WHERE keycol = 1; DELETE FROM hash_split_heap WHERE keycol = 1;
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 50000) a; INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a;
VACUUM hash_split_heap; VACUUM hash_split_heap;
REINDEX INDEX hash_split_index;
-- Clean up. -- Clean up.
DROP TABLE hash_split_heap; DROP TABLE hash_split_heap;
-- Index on temp table. -- Index on temp table.
......
...@@ -156,10 +156,9 @@ SELECT h.seqno AS f20000 ...@@ -156,10 +156,9 @@ SELECT h.seqno AS f20000
-- Cause some overflow insert and splits. -- Cause some overflow insert and splits.
-- --
CREATE TABLE hash_split_heap (keycol INT); CREATE TABLE hash_split_heap (keycol INT);
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a;
CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol); CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol);
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 70000) a; INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a;
VACUUM FULL hash_split_heap;
-- Let's do a backward scan. -- Let's do a backward scan.
BEGIN; BEGIN;
...@@ -173,12 +172,11 @@ MOVE BACKWARD ALL FROM c; ...@@ -173,12 +172,11 @@ MOVE BACKWARD ALL FROM c;
CLOSE c; CLOSE c;
END; END;
-- DELETE, INSERT, REBUILD INDEX. -- DELETE, INSERT, VACUUM.
DELETE FROM hash_split_heap WHERE keycol = 1; DELETE FROM hash_split_heap WHERE keycol = 1;
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 50000) a; INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a;
VACUUM hash_split_heap; VACUUM hash_split_heap;
REINDEX INDEX hash_split_index;
-- Clean up. -- Clean up.
DROP TABLE hash_split_heap; DROP TABLE hash_split_heap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment