git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 01effb1)
Reduce running time of jsonb_sqljson test
Wed, 6 Apr 2022 14:25:45 +0000 (10:25 -0400)
Wed, 6 Apr 2022 14:25:45 +0000 (10:25 -0400)
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


diff --git a/src/test/regress/expected/jsonb_sqljson.out b/src/test/regress/expected/jsonb_sqljson.out
index ae77af7ae23fe199c90b9b9d1bae78765fffc4d6..230cfd3bfd527cea8cfd0c3b8598f5a6d95b45d1 100644 (file)
--- 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 90c5975488974453f1698748c09b132f04fa3ec7..866c708a4d7721c62ca98cfdaa246d913aac76e4 100644 (file)
--- 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)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /