@ -2176,36 +2176,36 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4);
prepare ab_q2 (int, int) as
select a from ab where a between $1 and $2 and b < (select 3);
explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2);
QUERY PLAN
---------------------------------------------------------
QUERY PLAN
-----------------------------------------------------------------------
Append (actual rows=0 loops=1)
Subplans Removed: 6
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < $0 ))
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1 ))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < $0 ))
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1 ))
-> Seq Scan on ab_a2_b3 ab_3 (never executed)
Filter: ((a >= $1) AND (a <= $2) AND (b < $0 ))
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1 ))
(10 rows)
-- As above, but swap the PARAM_EXEC Param to the first partition level
prepare ab_q3 (int, int) as
select a from ab where b between $1 and $2 and a < (select 3);
explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2);
QUERY PLAN
---------------------------------------------------------
QUERY PLAN
-----------------------------------------------------------------------
Append (actual rows=0 loops=1)
Subplans Removed: 6
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b2 ab_1 (actual rows=0 loops=1)
Filter: ((b >= $1) AND (b <= $2) AND (a < $0 ))
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1 ))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
Filter: ((b >= $1) AND (b <= $2) AND (a < $0 ))
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1 ))
-> Seq Scan on ab_a3_b2 ab_3 (never executed)
Filter: ((b >= $1) AND (b <= $2) AND (a < $0 ))
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1 ))
(10 rows)
--
@ -2411,25 +2411,24 @@ select explain_parallel_append('execute ab_q5 (33, 44, 55)');
-- Test Parallel Append with PARAM_EXEC Params
select explain_parallel_append('select count(*) from ab where (a = (select 1) or a = (select 3)) and b = 2');
explain_parallel_append
------------------------------------------------------------------------------
explain_parallel_append
------------------------------------------------------------------------------------------------
Aggregate (actual rows=N loops=N)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=N loops=N)
InitPlan 2 (returns $1)
InitPlan 2
-> Result (actual rows=N loops=N)
-> Gather (actual rows=N loops=N)
Workers Planned: 2
Params Evaluated: $0, $1
Workers Launched: N
-> Parallel Append (actual rows=N loops=N)
-> Parallel Seq Scan on ab_a1_b2 ab_1 (actual rows=N loops=N)
Filter: ((b = 2) AND ((a = $0) OR (a = $ 1)))
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col 1)))
-> Parallel Seq Scan on ab_a2_b2 ab_2 (never executed)
Filter: ((b = 2) AND ((a = $0) OR (a = $ 1)))
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col 1)))
-> Parallel Seq Scan on ab_a3_b2 ab_3 (actual rows=N loops=N)
Filter: ((b = 2) AND ((a = $0) OR (a = $ 1)))
(16 rows)
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col 1)))
(15 rows)
-- Test pruning during parallel nested loop query
create table lprt_a (a int not null);
@ -2629,57 +2628,57 @@ select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1
QUERY PLAN
-------------------------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Aggregate (actual rows=1 loops=1)
-> Seq Scan on lprt_a (actual rows=102 loops=1)
InitPlan 2 (returns $1)
InitPlan 2
-> Aggregate (actual rows=1 loops=1)
-> Seq Scan on lprt_a lprt_a_1 (actual rows=102 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a2_b1 ab_4 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a2_b1_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a2_b2 ab_5 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a2_b2_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a2_b3 ab_6 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a2_b3_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a3_b1 ab_7 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a3_b1_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0 loops=1)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0 loops=1)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
-> Bitmap Heap Scan on ab_a3_b3 ab_9 (never executed)
Recheck Cond: (a = $0 )
Filter: (b = $ 1)
Recheck Cond: (a = (InitPlan 1).col1 )
Filter: (b = (InitPlan 2).col 1)
-> Bitmap Index Scan on ab_a3_b3_a_idx (never executed)
Index Cond: (a = $0 )
Index Cond: (a = (InitPlan 1).col1 )
(52 rows)
-- Test run-time partition pruning with UNION ALL parents
@ -2688,42 +2687,42 @@ select * from (select * from ab where a = 1 union all select * from ab) ab where
QUERY PLAN
-------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Append (actual rows=0 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0 loops=1)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
Index Cond: (a = 1)
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
(37 rows)
-- A case containing a UNION ALL with a non-partitioned child.
@ -2732,44 +2731,44 @@ select * from (select * from ab where a = 1 union all (values(10,5)) union all s
QUERY PLAN
-------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Append (actual rows=0 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0 loops=1)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
Recheck Cond: (a = 1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
Index Cond: (a = 1)
-> Result (actual rows=0 loops=1)
One-Time Filter: (5 = $0 )
One-Time Filter: (5 = (InitPlan 1).col1 )
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
(39 rows)
-- Another UNION ALL test, but containing a mix of exec init and exec run-time pruning.
@ -2787,27 +2786,27 @@ union all
) ab where a = $1 and b = (select -10);
-- Ensure the xy_1 subplan is not pruned.
explain (analyze, costs off, summary off, timing off) execute ab_q6(1);
QUERY PLAN
--------------------------------------------------
QUERY PLAN
--------------------------------------------------------
Append (actual rows=0 loops=1)
Subplans Removed: 12
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b1 ab_1 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
-> Seq Scan on xy_1 (actual rows=0 loops=1)
Filter: ((x = $1) AND (y = $0 ))
Filter: ((x = $1) AND (y = (InitPlan 1).col1 ))
Rows Removed by Filter: 1
-> Seq Scan on ab_a1_b1 ab_4 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
-> Seq Scan on ab_a1_b2 ab_5 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
-> Seq Scan on ab_a1_b3 ab_6 (never executed)
Filter: ((a = $1) AND (b = $0 ))
Filter: ((a = $1) AND (b = (InitPlan 1).col1 ))
(19 rows)
-- Ensure we see just the xy_1 row.
@ -2886,7 +2885,7 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);
Update on ab_a1_b1 ab_a1_1
Update on ab_a1_b2 ab_a1_2
Update on ab_a1_b3 ab_a1_3
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Nested Loop (actual rows=3 loops=1)
-> Append (actual rows=3 loops=1)
@ -2896,11 +2895,11 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);
-> Materialize (actual rows=1 loops=3)
-> Append (actual rows=1 loops=1)
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b2 ab_a2_2 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
-> Seq Scan on ab_a2_b3 ab_a2_3 (never executed)
Filter: (b = $0 )
Filter: (b = (InitPlan 1).col1 )
(19 rows)
select tableoid::regclass, * from ab;
@ -3234,12 +3233,12 @@ select * from listp where a = (select null::int);
QUERY PLAN
------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on listp_1_1 listp_1 (never executed)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
-> Seq Scan on listp_2_1 listp_2 (never executed)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
(7 rows)
drop table listp;
@ -3377,14 +3376,14 @@ prepare ps1 as
select * from mc3p where a = $1 and abs(b) < (select 3);
explain (analyze, costs off, summary off, timing off)
execute ps1(1);
QUERY PLAN
--------------------------------------------------------
QUERY PLAN
-------------------------------------------------------------
Append (actual rows=1 loops=1)
Subplans Removed: 2
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on mc3p1 mc3p_1 (actual rows=1 loops=1)
Filter: ((a = $1) AND (abs(b) < $0 ))
Filter: ((a = $1) AND (abs(b) < (InitPlan 1).col1 ))
(6 rows)
deallocate ps1;
@ -3392,16 +3391,16 @@ prepare ps2 as
select * from mc3p where a <= $1 and abs(b) < (select 3);
explain (analyze, costs off, summary off, timing off)
execute ps2(1);
QUERY PLAN
--------------------------------------------------------
QUERY PLAN
--------------------------------------------------------------
Append (actual rows=2 loops=1)
Subplans Removed: 1
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1 loops=1)
Filter: ((a <= $1) AND (abs(b) < $0 ))
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1 ))
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1 loops=1)
Filter: ((a <= $1) AND (abs(b) < $0 ))
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1 ))
(8 rows)
deallocate ps2;
@ -3417,14 +3416,14 @@ select * from boolp where a = (select value from boolvalues where value);
QUERY PLAN
-----------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Seq Scan on boolvalues (actual rows=1 loops=1)
Filter: value
Rows Removed by Filter: 1
-> Seq Scan on boolp_f boolp_1 (never executed)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
-> Seq Scan on boolp_t boolp_2 (actual rows=0 loops=1)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
(9 rows)
explain (analyze, costs off, summary off, timing off)
@ -3432,14 +3431,14 @@ select * from boolp where a = (select value from boolvalues where not value);
QUERY PLAN
-----------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Seq Scan on boolvalues (actual rows=1 loops=1)
Filter: (NOT value)
Rows Removed by Filter: 1
-> Seq Scan on boolp_f boolp_1 (actual rows=0 loops=1)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
-> Seq Scan on boolp_t boolp_2 (never executed)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
(9 rows)
drop table boolp;
@ -3528,18 +3527,18 @@ explain (analyze, costs off, summary off, timing off) select * from ma_test wher
-----------------------------------------------------------------------------------------------
Merge Append (actual rows=20 loops=1)
Sort Key: ma_test.b
InitPlan 2 (returns $1)
InitPlan 2
-> Result (actual rows=1 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Limit (actual rows=1 loops=1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1 loops=1)
Index Cond: (b IS NOT NULL)
-> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed)
Filter: (a >= $ 1)
Filter: (a >= (InitPlan 2).col 1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10 loops=1)
Filter: (a >= $ 1)
Filter: (a >= (InitPlan 2).col 1)
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10 loops=1)
Filter: (a >= $ 1)
Filter: (a >= (InitPlan 2).col 1)
(14 rows)
reset enable_seqscan;
@ -3908,17 +3907,17 @@ from (
select 1, 1, 1
) s(a, b, c)
where s.a = 1 and s.b = 1 and s.c = (select 1);
QUERY PLAN
----------------------------------------------------
QUERY PLAN
-------------------------------------------------------------------
Append
InitPlan 1 (returns $0)
InitPlan 1
-> Result
-> Seq Scan on p1 p
Filter: ((a = 1) AND (b = 1) AND (c = $0 ))
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan 1).col1 ))
-> Seq Scan on q111 q1
Filter: ((a = 1) AND (b = 1) AND (c = $0 ))
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan 1).col1 ))
-> Result
One-Time Filter: (1 = $0 )
One-Time Filter: (1 = (InitPlan 1).col1 )
(9 rows)
select *
@ -3946,18 +3945,18 @@ from (
) s(a, b, c)
where s.a = $1 and s.b = $2 and s.c = (select 1);
explain (costs off) execute q (1, 1);
QUERY PLAN
---------------------------------------------------------------
QUERY PLAN
------------------------------------------------------------------------------
Append
Subplans Removed: 1
InitPlan 1 (returns $0)
InitPlan 1
-> Result
-> Seq Scan on p1 p
Filter: ((a = $1) AND (b = $2) AND (c = $0 ))
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan 1).col1 ))
-> Seq Scan on q111 q1
Filter: ((a = $1) AND (b = $2) AND (c = $0 ))
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan 1).col1 ))
-> Result
One-Time Filter: ((1 = $1) AND (1 = $2) AND (1 = $0 ))
One-Time Filter: ((1 = $1) AND (1 = $2) AND (1 = (InitPlan 1).col1 ))
(10 rows)
execute q (1, 1);
@ -3975,11 +3974,11 @@ create table listp2 partition of listp for values in(2) partition by list(b);
create table listp2_10 partition of listp2 for values in (10);
explain (analyze, costs off, summary off, timing off)
select * from listp where a = (select 2) and b <> 10;
QUERY PLAN
--------------------------------------------------
QUERY PLAN
---------------------------------------------------
Seq Scan on listp1 listp (actual rows=0 loops=1)
Filter: ((b <> 10) AND (a = $0 ))
InitPlan 1 (returns $0)
Filter: ((b <> 10) AND (a = (InitPlan 1).col1 ))
InitPlan 1
-> Result (never executed)
(4 rows)
@ -4044,16 +4043,15 @@ select explain_parallel_append('select * from listp where a = (select 1);');
----------------------------------------------------------------------
Gather (actual rows=N loops=N)
Workers Planned: 2
Params Evaluated: $0
Workers Launched: N
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=N loops=N)
-> Parallel Append (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
Filter: (a = $0 )
(11 rows)
Filter: (a = (InitPlan 1).col1 )
(10 rows)
-- Like the above but throw some more complexity at the planner by adding
-- a UNION ALL. We expect both sides of the union not to scan the
@ -4069,19 +4067,19 @@ select * from listp where a = (select 2);');
Workers Launched: N
-> Parallel Append (actual rows=N loops=N)
-> Parallel Append (actual rows=N loops=N)
InitPlan 2 (returns $1)
InitPlan 2
-> Result (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_1 (never executed)
Filter: (a = $ 1)
Filter: (a = (InitPlan 2).col 1)
-> Parallel Seq Scan on listp_12_2 listp_2 (actual rows=N loops=N)
Filter: (a = $ 1)
Filter: (a = (InitPlan 2).col 1)
-> Parallel Append (actual rows=N loops=N)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_4 (actual rows=N loops=N)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
-> Parallel Seq Scan on listp_12_2 listp_5 (never executed)
Filter: (a = $0 )
Filter: (a = (InitPlan 1).col1 )
(18 rows)
drop table listp;
@ -4104,20 +4102,20 @@ select * from rangep where b IN((select 1),(select 2)) order by a;
QUERY PLAN
------------------------------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
InitPlan 1 (returns $0)
InitPlan 1
-> Result (actual rows=1 loops=1)
InitPlan 2 (returns $1)
InitPlan 2
-> Result (actual rows=1 loops=1)
-> Merge Append (actual rows=0 loops=1)
Sort Key: rangep_2.a
-> Index Scan using rangep_0_to_100_1_a_idx on rangep_0_to_100_1 rangep_2 (actual rows=0 loops=1)
Filter: (b = ANY (ARRAY[$0, $ 1]))
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col 1]))
-> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0 loops=1)
Filter: (b = ANY (ARRAY[$0, $ 1]))
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col 1]))
-> Index Scan using rangep_0_to_100_3_a_idx on rangep_0_to_100_3 rangep_4 (never executed)
Filter: (b = ANY (ARRAY[$0, $ 1]))
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col 1]))
-> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0 loops=1)
Filter: (b = ANY (ARRAY[$0, $ 1]))
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col 1]))
(15 rows)
reset enable_sort;