Skip to content

Commit 4a8bc39

Browse files
committed
Speed up hash_index regression test.
Commit f5ab0a1 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
1 parent 16ebab6 commit 4a8bc39

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/test/regress/expected/hash_index.out

+4-5
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ SELECT h.seqno AS f20000
200200
-- Cause some overflow insert and splits.
201201
--
202202
CREATE TABLE hash_split_heap (keycol INT);
203+
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a;
203204
CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol);
204-
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 70000) a;
205-
VACUUM FULL hash_split_heap;
205+
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a;
206206
-- Let's do a backward scan.
207207
BEGIN;
208208
SET enable_seqscan = OFF;
@@ -213,11 +213,10 @@ MOVE BACKWARD 10000 FROM c;
213213
MOVE BACKWARD ALL FROM c;
214214
CLOSE c;
215215
END;
216-
-- DELETE, INSERT, REBUILD INDEX.
216+
-- DELETE, INSERT, VACUUM.
217217
DELETE FROM hash_split_heap WHERE keycol = 1;
218-
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 50000) a;
218+
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a;
219219
VACUUM hash_split_heap;
220-
REINDEX INDEX hash_split_index;
221220
-- Clean up.
222221
DROP TABLE hash_split_heap;
223222
-- Index on temp table.

src/test/regress/sql/hash_index.sql

+4-6
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,9 @@ SELECT h.seqno AS f20000
156156
-- Cause some overflow insert and splits.
157157
--
158158
CREATE TABLE hash_split_heap (keycol INT);
159+
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a;
159160
CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol);
160-
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 70000) a;
161-
162-
VACUUM FULL hash_split_heap;
161+
INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a;
163162

164163
-- Let's do a backward scan.
165164
BEGIN;
@@ -173,12 +172,11 @@ MOVE BACKWARD ALL FROM c;
173172
CLOSE c;
174173
END;
175174

176-
-- DELETE, INSERT, REBUILD INDEX.
175+
-- DELETE, INSERT, VACUUM.
177176
DELETE FROM hash_split_heap WHERE keycol = 1;
178-
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 50000) a;
177+
INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a;
179178

180179
VACUUM hash_split_heap;
181-
REINDEX INDEX hash_split_index;
182180

183181
-- Clean up.
184182
DROP TABLE hash_split_heap;

0 commit comments

Comments
 (0)