Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit14d3f24

Browse files
committed
Further improve jsonb_sqljson parallel test
Instead of using a very large table, use some settings to encourage useof parallelism. Also, drop the table so it doesn't upset the recoverytest.per suggestion from Andres FreundDiscussion:https://postgr.es/m/20220406022118.3ocqvhxr6kciw5am@alap3.anarazel.de
1 parenta0ffa88 commit14d3f24

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

‎src/test/regress/expected/jsonb_sqljson.out

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,13 @@ LINE 1: SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || '...
20902090
-- Test parallel JSON_VALUE()
20912091
CREATE UNLOGGED TABLE test_parallel_jsonb_value AS
20922092
SELECT i::text::jsonb AS js
2093-
FROM generate_series(1, 500000) i;
2093+
FROM generate_series(1, 50000) i;
2094+
-- encourage use of parallel plans
2095+
set parallel_setup_cost=0;
2096+
set parallel_tuple_cost=0;
2097+
set min_parallel_table_scan_size=0;
2098+
set max_parallel_workers_per_gather=4;
2099+
set parallel_leader_participation = off;
20942100
-- Should be non-parallel due to subtransactions
20952101
EXPLAIN (COSTS OFF)
20962102
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value;
@@ -2101,9 +2107,9 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value
21012107
(2 rows)
21022108

21032109
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value;
2104-
sum
2105-
--------------
2106-
125000250000
2110+
sum
2111+
------------
2112+
1250025000
21072113
(1 row)
21082114

21092115
-- Should be parallel
@@ -2113,14 +2119,15 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_paral
21132119
------------------------------------------------------------------
21142120
Finalize Aggregate
21152121
-> Gather
2116-
Workers Planned:2
2122+
Workers Planned:4
21172123
-> Partial Aggregate
21182124
-> Parallel Seq Scan on test_parallel_jsonb_value
21192125
(5 rows)
21202126

21212127
SELECT sum(JSON_VALUE(js, '$' RETURNING numeric ERROR ON ERROR)) FROM test_parallel_jsonb_value;
2122-
sum
2123-
--------------
2124-
125000250000
2128+
sum
2129+
------------
2130+
1250025000
21252131
(1 row)
21262132

2133+
DROP TABLE test_parallel_jsonb_value;

‎src/test/regress/sql/jsonb_sqljson.sql

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

950950
-- Test parallel JSON_VALUE()
951+
952+
951953
CREATE UNLOGGED TABLE test_parallel_jsonb_valueAS
952954
SELECT i::text::jsonbAS js
953-
FROM generate_series(1,500000) i;
955+
FROM generate_series(1,50000) i;
956+
957+
958+
-- encourage use of parallel plans
959+
set parallel_setup_cost=0;
960+
set parallel_tuple_cost=0;
961+
set min_parallel_table_scan_size=0;
962+
set max_parallel_workers_per_gather=4;
963+
set parallel_leader_participation= off;
954964

955965
-- Should be non-parallel due to subtransactions
956966
EXPLAIN (COSTS OFF)
@@ -961,3 +971,5 @@ SELECT sum(JSON_VALUE(js, '$' RETURNING numeric)) FROM test_parallel_jsonb_value
961971
EXPLAIN (COSTS OFF)
962972
SELECTsum(JSON_VALUE(js,'$' RETURNINGnumeric ERRORON ERROR))FROM test_parallel_jsonb_value;
963973
SELECTsum(JSON_VALUE(js,'$' RETURNINGnumeric ERRORON ERROR))FROM test_parallel_jsonb_value;
974+
975+
DROPTABLE test_parallel_jsonb_value;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp