@@ -1563,7 +1563,10 @@ select avg(a) from ab where a between $1 and $2 and b < 4;
1563
1563
set parallel_setup_cost = 0;
1564
1564
set parallel_tuple_cost = 0;
1565
1565
set min_parallel_table_scan_size = 0;
1566
+ -- set this so we get a parallel plan
1566
1567
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;
1567
1570
-- Execute query 5 times to allow choose_custom_plan
1568
1571
-- to start considering a generic plan.
1569
1572
execute ab_q4 (1, 8);
@@ -1600,11 +1603,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q4 (2, 2);
1600
1603
QUERY PLAN
1601
1604
-------------------------------------------------------------------------------
1602
1605
Finalize Aggregate (actual rows=1 loops=1)
1603
- -> Gather (actual rows=3 loops=1)
1606
+ -> Gather (actual rows=1 loops=1)
1604
1607
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 )
1608
1611
Subplans Removed: 6
1609
1612
-> Parallel Seq Scan on ab_a2_b1 (actual rows=0 loops=1)
1610
1613
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);
1653
1656
QUERY PLAN
1654
1657
-------------------------------------------------------------------------------
1655
1658
Finalize Aggregate (actual rows=1 loops=1)
1656
- -> Gather (actual rows=3 loops=1)
1659
+ -> Gather (actual rows=1 loops=1)
1657
1660
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 )
1661
1664
Subplans Removed: 6
1662
1665
-> Parallel Seq Scan on ab_a1_b1 (actual rows=0 loops=1)
1663
1666
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);
1671
1674
QUERY PLAN
1672
1675
-------------------------------------------------------------------------------
1673
1676
Finalize Aggregate (actual rows=1 loops=1)
1674
- -> Gather (actual rows=3 loops=1)
1677
+ -> Gather (actual rows=1 loops=1)
1675
1678
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 )
1679
1682
Subplans Removed: 3
1680
1683
-> Parallel Seq Scan on ab_a2_b1 (actual rows=0 loops=1)
1681
1684
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)
1697
1700
QUERY PLAN
1698
1701
-------------------------------------------------------------------------------
1699
1702
Finalize Aggregate (actual rows=1 loops=1)
1700
- -> Gather (actual rows=3 loops=1)
1703
+ -> Gather (actual rows=1 loops=1)
1701
1704
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 )
1705
1708
Subplans Removed: 8
1706
1709
-> Parallel Seq Scan on ab_a1_b1 (never executed)
1707
1710
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);
1761
1764
QUERY PLAN
1762
1765
---------------------------------------------------------------------------------------------------
1763
1766
Finalize Aggregate (actual rows=1 loops=1)
1764
- -> Gather (actual rows=2 loops=1)
1767
+ -> Gather (actual rows=1 loops=1)
1765
1768
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 )
1770
1773
Filter: (a = ANY ('{0,0,1}'::integer[]))
1771
1774
-> Append (actual rows=0 loops=102)
1772
1775
-> 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);
1794
1797
QUERY PLAN
1795
1798
---------------------------------------------------------------------------------------------------
1796
1799
Finalize Aggregate (actual rows=1 loops=1)
1797
- -> Gather (actual rows=2 loops=1)
1800
+ -> Gather (actual rows=1 loops=1)
1798
1801
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 )
1803
1806
Filter: (a = ANY ('{1,0,3}'::integer[]))
1804
1807
-> Append (actual rows=0 loops=104)
1805
1808
-> 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);
1826
1829
QUERY PLAN
1827
1830
---------------------------------------------------------------------------------------------------
1828
1831
Finalize Aggregate (actual rows=1 loops=1)
1829
- -> Gather (actual rows=2 loops=1)
1832
+ -> Gather (actual rows=1 loops=1)
1830
1833
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 )
1835
1838
Filter: (a = ANY ('{1,0,0}'::integer[]))
1836
- Rows Removed by Filter: 1
1839
+ Rows Removed by Filter: 2
1837
1840
-> Append (actual rows=0 loops=102)
1838
1841
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=2)
1839
1842
Index Cond: (a = a.a)
@@ -1860,14 +1863,14 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6 (1, 0, 0);
1860
1863
QUERY PLAN
1861
1864
--------------------------------------------------------------------------------------------
1862
1865
Finalize Aggregate (actual rows=1 loops=1)
1863
- -> Gather (actual rows=2 loops=1)
1866
+ -> Gather (actual rows=1 loops=1)
1864
1867
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 )
1869
1872
Filter: (a = ANY ('{1,0,0}'::integer[]))
1870
- Rows Removed by Filter: 1
1873
+ Rows Removed by Filter: 2
1871
1874
-> Append (actual rows=0 loops=100)
1872
1875
-> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
1873
1876
Index Cond: (a = a.a)
0 commit comments