mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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
This commit is contained in:
parent
01effb1304
commit
2ef6f11b0c
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user