Skip to content

Commit 2ef6f11

Browse files
committed
Reduce running time of jsonb_sqljson test
The test created a 1m row table in order to test parallel operation of JSON_VALUE. However, this was more than were needed for the test, so save time by halving it, and also by making the table unlogged. Experimentation shows that this size is only a little above the number required to generate the expected output. Per gripe from Andres Freund Discussion: https://postgr.es/m/20220406022118.3ocqvhxr6kciw5am@alap3.anarazel.de
1 parent 01effb1 commit 2ef6f11

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/regress/expected/jsonb_sqljson.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,9 +2088,9 @@ ERROR: only string constants supported in JSON_TABLE path specification
20882088
LINE 1: SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || '...
20892089
^
20902090
-- Test parallel JSON_VALUE()
2091-
CREATE TABLE test_parallel_jsonb_value AS
2091+
CREATE UNLOGGED TABLE test_parallel_jsonb_value AS
20922092
SELECT i::text::jsonb AS js
2093-
FROM generate_series(1, 1000000) i;
2093+
FROM generate_series(1, 500000) i;
20942094
-- Should be non-parallel due to subtransactions
20952095
EXPLAIN (COSTS OFF)
20962096
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value;
@@ -2103,7 +2103,7 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value
21032103
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value;
21042104
sum
21052105
--------------
2106-
500000500000
2106+
125000250000
21072107
(1 row)
21082108

21092109
-- Should be parallel
@@ -2121,6 +2121,6 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_paral
21212121
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_parallel_jsonb_value;
21222122
sum
21232123
--------------
2124-
500000500000
2124+
125000250000
21252125
(1 row)
21262126

src/test/regress/sql/jsonb_sqljson.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,9 @@ SELECT JSON_QUERY(jsonb '{"a": 123}', 'error' || ' ' || 'error');
948948
SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || 'a' COLUMNS (foo int));
949949

950950
-- Test parallel JSON_VALUE()
951-
CREATE TABLE test_parallel_jsonb_value AS
951+
CREATE UNLOGGED TABLE test_parallel_jsonb_value AS
952952
SELECT i::text::jsonb AS js
953-
FROM generate_series(1, 1000000) i;
953+
FROM generate_series(1, 500000) i;
954954

955955
-- Should be non-parallel due to subtransactions
956956
EXPLAIN (COSTS OFF)

0 commit comments

Comments
 (0)