From 2ef6f11b0c77ec323c688ddfd98ffabddb72c11d Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 6 Apr 2022 10:25:45 -0400 Subject: [PATCH] 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 --- src/test/regress/expected/jsonb_sqljson.out | 8 ++++---- src/test/regress/sql/jsonb_sqljson.sql | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/regress/expected/jsonb_sqljson.out b/src/test/regress/expected/jsonb_sqljson.out index ae77af7ae23..230cfd3bfd5 100644 --- a/src/test/regress/expected/jsonb_sqljson.out +++ b/src/test/regress/expected/jsonb_sqljson.out @@ -2088,9 +2088,9 @@ ERROR: only string constants supported in JSON_TABLE path specification LINE 1: SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || '... ^ -- Test parallel JSON_VALUE() -CREATE TABLE test_parallel_jsonb_value AS +CREATE UNLOGGED TABLE test_parallel_jsonb_value AS SELECT i::text::jsonb AS js -FROM generate_series(1, 1000000) i; +FROM generate_series(1, 500000) i; -- Should be non-parallel due to subtransactions EXPLAIN (COSTS OFF) 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 SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value; sum -------------- - 500000500000 + 125000250000 (1 row) -- Should be parallel @@ -2121,6 +2121,6 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_paral SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_parallel_jsonb_value; sum -------------- - 500000500000 + 125000250000 (1 row) diff --git a/src/test/regress/sql/jsonb_sqljson.sql b/src/test/regress/sql/jsonb_sqljson.sql index 90c59754889..866c708a4d7 100644 --- a/src/test/regress/sql/jsonb_sqljson.sql +++ b/src/test/regress/sql/jsonb_sqljson.sql @@ -948,9 +948,9 @@ SELECT JSON_QUERY(jsonb '{"a": 123}', 'error' || ' ' || 'error'); SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || 'a' COLUMNS (foo int)); -- Test parallel JSON_VALUE() -CREATE TABLE test_parallel_jsonb_value AS +CREATE UNLOGGED TABLE test_parallel_jsonb_value AS SELECT i::text::jsonb AS js -FROM generate_series(1, 1000000) i; +FROM generate_series(1, 500000) i; -- Should be non-parallel due to subtransactions EXPLAIN (COSTS OFF)