Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4d0f6d3

Browse files
committed
Attempt to stabilize partition_prune test output (2)
Environmental conditions might cause parallel workers to be scheduled in different ways in this test, destabilizing the EXPLAIN output. Disable use of workers in an attempt to make output stable. Author: David Rowley Diagnosed-by: Thomas Munro Discussion: https://postgr.es/m/CAKJS1f8j24tUX_nOwACiM=UO5jrMrDz8ca0xbG0vhVgfWph0ZA@mail.gmail.com
1 parent 65a69df commit 4d0f6d3

File tree

2 files changed

+46
-38
lines changed

2 files changed

+46
-38
lines changed

src/test/regress/expected/partition_prune.out

+41-38
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,10 @@ select avg(a) from ab where a between $1 and $2 and b < 4;
15631563
set parallel_setup_cost = 0;
15641564
set parallel_tuple_cost = 0;
15651565
set min_parallel_table_scan_size = 0;
1566+
-- set this so we get a parallel plan
15661567
set max_parallel_workers_per_gather = 2;
1568+
-- and zero this so that workers don't destabilize the explain output
1569+
set max_parallel_workers = 0;
15671570
-- Execute query 5 times to allow choose_custom_plan
15681571
-- to start considering a generic plan.
15691572
execute ab_q4 (1, 8);
@@ -1600,11 +1603,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q4 (2, 2);
16001603
QUERY PLAN
16011604
-------------------------------------------------------------------------------
16021605
Finalize Aggregate (actual rows=1 loops=1)
1603-
-> Gather (actual rows=3 loops=1)
1606+
-> Gather (actual rows=1 loops=1)
16041607
Workers Planned: 2
1605-
Workers Launched: 2
1606-
-> Partial Aggregate (actual rows=1 loops=3)
1607-
-> Parallel Append (actual rows=0 loops=3)
1608+
Workers Launched: 0
1609+
-> Partial Aggregate (actual rows=1 loops=1)
1610+
-> Parallel Append (actual rows=0 loops=1)
16081611
Subplans Removed: 6
16091612
-> Parallel Seq Scan on ab_a2_b1 (actual rows=0 loops=1)
16101613
Filter: ((a >= $1) AND (a <= $2) AND (b < 4))
@@ -1653,11 +1656,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q5 (1, 1, 1);
16531656
QUERY PLAN
16541657
-------------------------------------------------------------------------------
16551658
Finalize Aggregate (actual rows=1 loops=1)
1656-
-> Gather (actual rows=3 loops=1)
1659+
-> Gather (actual rows=1 loops=1)
16571660
Workers Planned: 2
1658-
Workers Launched: 2
1659-
-> Partial Aggregate (actual rows=1 loops=3)
1660-
-> Parallel Append (actual rows=0 loops=3)
1661+
Workers Launched: 0
1662+
-> Partial Aggregate (actual rows=1 loops=1)
1663+
-> Parallel Append (actual rows=0 loops=1)
16611664
Subplans Removed: 6
16621665
-> Parallel Seq Scan on ab_a1_b1 (actual rows=0 loops=1)
16631666
Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3])))
@@ -1671,11 +1674,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q5 (2, 3, 3);
16711674
QUERY PLAN
16721675
-------------------------------------------------------------------------------
16731676
Finalize Aggregate (actual rows=1 loops=1)
1674-
-> Gather (actual rows=3 loops=1)
1677+
-> Gather (actual rows=1 loops=1)
16751678
Workers Planned: 2
1676-
Workers Launched: 2
1677-
-> Partial Aggregate (actual rows=1 loops=3)
1678-
-> Parallel Append (actual rows=0 loops=3)
1679+
Workers Launched: 0
1680+
-> Partial Aggregate (actual rows=1 loops=1)
1681+
-> Parallel Append (actual rows=0 loops=1)
16791682
Subplans Removed: 3
16801683
-> Parallel Seq Scan on ab_a2_b1 (actual rows=0 loops=1)
16811684
Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3])))
@@ -1697,11 +1700,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q5 (33, 44, 55)
16971700
QUERY PLAN
16981701
-------------------------------------------------------------------------------
16991702
Finalize Aggregate (actual rows=1 loops=1)
1700-
-> Gather (actual rows=3 loops=1)
1703+
-> Gather (actual rows=1 loops=1)
17011704
Workers Planned: 2
1702-
Workers Launched: 2
1703-
-> Partial Aggregate (actual rows=1 loops=3)
1704-
-> Parallel Append (actual rows=0 loops=3)
1705+
Workers Launched: 0
1706+
-> Partial Aggregate (actual rows=1 loops=1)
1707+
-> Parallel Append (actual rows=0 loops=1)
17051708
Subplans Removed: 8
17061709
-> Parallel Seq Scan on ab_a1_b1 (never executed)
17071710
Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3])))
@@ -1761,12 +1764,12 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6 (0, 0, 1);
17611764
QUERY PLAN
17621765
---------------------------------------------------------------------------------------------------
17631766
Finalize Aggregate (actual rows=1 loops=1)
1764-
-> Gather (actual rows=2 loops=1)
1767+
-> Gather (actual rows=1 loops=1)
17651768
Workers Planned: 1
1766-
Workers Launched: 1
1767-
-> Partial Aggregate (actual rows=1 loops=2)
1768-
-> Nested Loop (actual rows=0 loops=2)
1769-
-> Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
1769+
Workers Launched: 0
1770+
-> Partial Aggregate (actual rows=1 loops=1)
1771+
-> Nested Loop (actual rows=0 loops=1)
1772+
-> Parallel Seq Scan on lprt_a a (actual rows=102 loops=1)
17701773
Filter: (a = ANY ('{0,0,1}'::integer[]))
17711774
-> Append (actual rows=0 loops=102)
17721775
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=2)
@@ -1794,12 +1797,12 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6 (1, 0, 3);
17941797
QUERY PLAN
17951798
---------------------------------------------------------------------------------------------------
17961799
Finalize Aggregate (actual rows=1 loops=1)
1797-
-> Gather (actual rows=2 loops=1)
1800+
-> Gather (actual rows=1 loops=1)
17981801
Workers Planned: 1
1799-
Workers Launched: 1
1800-
-> Partial Aggregate (actual rows=1 loops=2)
1801-
-> Nested Loop (actual rows=0 loops=2)
1802-
-> Parallel Seq Scan on lprt_a a (actual rows=52 loops=2)
1802+
Workers Launched: 0
1803+
-> Partial Aggregate (actual rows=1 loops=1)
1804+
-> Nested Loop (actual rows=0 loops=1)
1805+
-> Parallel Seq Scan on lprt_a a (actual rows=104 loops=1)
18031806
Filter: (a = ANY ('{1,0,3}'::integer[]))
18041807
-> Append (actual rows=0 loops=104)
18051808
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=2)
@@ -1826,14 +1829,14 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6 (1, 0, 0);
18261829
QUERY PLAN
18271830
---------------------------------------------------------------------------------------------------
18281831
Finalize Aggregate (actual rows=1 loops=1)
1829-
-> Gather (actual rows=2 loops=1)
1832+
-> Gather (actual rows=1 loops=1)
18301833
Workers Planned: 1
1831-
Workers Launched: 1
1832-
-> Partial Aggregate (actual rows=1 loops=2)
1833-
-> Nested Loop (actual rows=0 loops=2)
1834-
-> Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
1834+
Workers Launched: 0
1835+
-> Partial Aggregate (actual rows=1 loops=1)
1836+
-> Nested Loop (actual rows=0 loops=1)
1837+
-> Parallel Seq Scan on lprt_a a (actual rows=102 loops=1)
18351838
Filter: (a = ANY ('{1,0,0}'::integer[]))
1836-
Rows Removed by Filter: 1
1839+
Rows Removed by Filter: 2
18371840
-> Append (actual rows=0 loops=102)
18381841
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=2)
18391842
Index Cond: (a = a.a)
@@ -1860,14 +1863,14 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6 (1, 0, 0);
18601863
QUERY PLAN
18611864
--------------------------------------------------------------------------------------------
18621865
Finalize Aggregate (actual rows=1 loops=1)
1863-
-> Gather (actual rows=2 loops=1)
1866+
-> Gather (actual rows=1 loops=1)
18641867
Workers Planned: 1
1865-
Workers Launched: 1
1866-
-> Partial Aggregate (actual rows=1 loops=2)
1867-
-> Nested Loop (actual rows=0 loops=2)
1868-
-> Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
1868+
Workers Launched: 0
1869+
-> Partial Aggregate (actual rows=1 loops=1)
1870+
-> Nested Loop (actual rows=0 loops=1)
1871+
-> Parallel Seq Scan on lprt_a a (actual rows=100 loops=1)
18691872
Filter: (a = ANY ('{1,0,0}'::integer[]))
1870-
Rows Removed by Filter: 1
1873+
Rows Removed by Filter: 2
18711874
-> Append (actual rows=0 loops=100)
18721875
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
18731876
Index Cond: (a = a.a)

src/test/regress/sql/partition_prune.sql

+5
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,13 @@ select avg(a) from ab where a between $1 and $2 and b < 4;
325325
set parallel_setup_cost = 0;
326326
set parallel_tuple_cost = 0;
327327
set min_parallel_table_scan_size = 0;
328+
329+
-- set this so we get a parallel plan
328330
set max_parallel_workers_per_gather = 2;
329331

332+
-- and zero this so that workers don't destabilize the explain output
333+
set max_parallel_workers = 0;
334+
330335
-- Execute query 5 times to allow choose_custom_plan
331336
-- to start considering a generic plan.
332337
execute ab_q4 (1, 8);

0 commit comments

Comments
 (0)