@ -2157,34 +2157,34 @@ set enable_indexonlyscan = off;
prepare ab_q1 (int, int, int) as
select * from ab where a between $1 and $2 and b <= $3;
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q1 (2, 2, 3);
QUERY PLAN
---------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 6
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a2_b3 ab_3 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b3 ab_3 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
(8 rows)
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q1 (1, 2, 3);
QUERY PLAN
---------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 3
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1)
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a1_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a1_b2 ab_2 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1)
-> Seq Scan on ab_a1_b3 ab_3 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a2_b2 ab_5 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_5 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
-> Seq Scan on ab_a2_b3 ab_6 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b3 ab_6 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b <= $3))
(14 rows)
@ -2193,28 +2193,28 @@ deallocate ab_q1;
prepare ab_q1 (int, int) as
select a from ab where a between $1 and $2 and b < 3;
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q1 (2, 2);
QUERY PLAN
---------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 4
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
(6 rows)
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q1 (2, 4);
QUERY PLAN
---------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
-> Seq Scan on ab_a3_b1 ab_3 (actual rows=0 loops=1)
-> Seq Scan on ab_a3_b1 ab_3 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
-> Seq Scan on ab_a3_b2 ab_4 (actual rows=0 loops=1)
-> Seq Scan on ab_a3_b2 ab_4 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < 3))
(10 rows)
@ -2225,13 +2225,13 @@ select a from ab where a between $1 and $2 and b < (select 3);
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q2 (2, 2);
QUERY PLAN
-----------------------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 6
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
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 < (InitPlan 1).col1))
@ -2243,13 +2243,13 @@ select a from ab where b between $1 and $2 and a < (select 3);
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q3 (2, 2);
QUERY PLAN
-----------------------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 6
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b2 ab_1 (actual rows=0 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on ab_a1_b2 ab_1 (actual rows=0.00 loops=1)
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1))
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
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 < (InitPlan 1).col1))
@ -2303,44 +2303,44 @@ begin;
create function list_part_fn(int) returns int as $$ begin return $1; end;$$ language plpgsql stable;
-- Ensure pruning works using a stable function containing no Vars
explain (analyze, costs off, summary off, timing off, buffers off) select * from list_part where a = list_part_fn(1);
QUERY PLAN
------------------------------------------------------------------
Append (actual rows=1 loops=1)
QUERY PLAN
---------------------------------------------------------------------
Append (actual rows=1.00 loops=1)
Subplans Removed: 3
-> Seq Scan on list_part1 list_part_1 (actual rows=1 loops=1)
-> Seq Scan on list_part1 list_part_1 (actual rows=1.00 loops=1)
Filter: (a = list_part_fn(1))
(4 rows)
-- Ensure pruning does not take place when the function has a Var parameter
explain (analyze, costs off, summary off, timing off, buffers off) select * from list_part where a = list_part_fn(a);
QUERY PLAN
------------------------------------------------------------------
Append (actual rows=4 loops=1)
-> Seq Scan on list_part1 list_part_1 (actual rows=1 loops=1)
QUERY PLAN
---------------------------------------------------------------------
Append (actual rows=4.00 loops=1)
-> Seq Scan on list_part1 list_part_1 (actual rows=1.00 loops=1)
Filter: (a = list_part_fn(a))
-> Seq Scan on list_part2 list_part_2 (actual rows=1 loops=1)
-> Seq Scan on list_part2 list_part_2 (actual rows=1.00 loops=1)
Filter: (a = list_part_fn(a))
-> Seq Scan on list_part3 list_part_3 (actual rows=1 loops=1)
-> Seq Scan on list_part3 list_part_3 (actual rows=1.00 loops=1)
Filter: (a = list_part_fn(a))
-> Seq Scan on list_part4 list_part_4 (actual rows=1 loops=1)
-> Seq Scan on list_part4 list_part_4 (actual rows=1.00 loops=1)
Filter: (a = list_part_fn(a))
(9 rows)
-- Ensure pruning does not take place when the expression contains a Var.
explain (analyze, costs off, summary off, timing off, buffers off) select * from list_part where a = list_part_fn(1) + a;
QUERY PLAN
------------------------------------------------------------------
Append (actual rows=0 loops=1)
-> Seq Scan on list_part1 list_part_1 (actual rows=0 loops=1)
QUERY PLAN
---------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
-> Seq Scan on list_part1 list_part_1 (actual rows=0.00 loops=1)
Filter: (a = (list_part_fn(1) + a))
Rows Removed by Filter: 1
-> Seq Scan on list_part2 list_part_2 (actual rows=0 loops=1)
-> Seq Scan on list_part2 list_part_2 (actual rows=0.00 loops=1)
Filter: (a = (list_part_fn(1) + a))
Rows Removed by Filter: 1
-> Seq Scan on list_part3 list_part_3 (actual rows=0 loops=1)
-> Seq Scan on list_part3 list_part_3 (actual rows=0.00 loops=1)
Filter: (a = (list_part_fn(1) + a))
Rows Removed by Filter: 1
-> Seq Scan on list_part4 list_part_4 (actual rows=0 loops=1)
-> Seq Scan on list_part4 list_part_4 (actual rows=0.00 loops=1)
Filter: (a = (list_part_fn(1) + a))
Rows Removed by Filter: 1
(13 rows)
@ -2672,15 +2672,15 @@ reset max_parallel_workers_per_gather;
-- Test run-time partition pruning with an initplan
explain (analyze, costs off, summary off, timing off, buffers off)
select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1 from lprt_a);
QUERY PLAN
-------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
----------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
InitPlan 1
-> Aggregate (actual rows=1 loops=1)
-> Seq Scan on lprt_a (actual rows=102 loops=1)
-> Aggregate (actual rows=1.00 loops=1)
-> Seq Scan on lprt_a (actual rows=102.00 loops=1)
InitPlan 2
-> Aggregate (actual rows=1 loops=1)
-> Seq Scan on lprt_a lprt_a_1 (actual rows=102 loops=1)
-> Aggregate (actual rows=1.00 loops=1)
-> Seq Scan on lprt_a lprt_a_1 (actual rows=102.00 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed)
Recheck Cond: (a = (InitPlan 1).col1)
Filter: (b = (InitPlan 2).col1)
@ -2716,10 +2716,10 @@ select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1
Filter: (b = (InitPlan 2).col1)
-> Bitmap Index Scan on ab_a3_b1_a_idx (never executed)
Index Cond: (a = (InitPlan 1).col1)
-> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0 loops=1)
-> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0.00 loops=1)
Recheck Cond: (a = (InitPlan 1).col1)
Filter: (b = (InitPlan 2).col1)
-> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0 loops=1)
-> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0.00 loops=1)
Index Cond: (a = (InitPlan 1).col1)
-> Bitmap Heap Scan on ab_a3_b3 ab_9 (never executed)
Recheck Cond: (a = (InitPlan 1).col1)
@ -2731,16 +2731,16 @@ select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1
-- Test run-time partition pruning with UNION ALL parents
explain (analyze, costs off, summary off, timing off, buffers off)
select * from (select * from ab where a = 1 union all select * from ab) ab where b = (select 1);
QUERY PLAN
-------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
----------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
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)
-> Result (actual rows=1.00 loops=1)
-> Append (actual rows=0.00 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
Filter: (b = (InitPlan 1).col1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
Recheck Cond: (a = 1)
@ -2752,19 +2752,19 @@ select * from (select * from ab where a = 1 union all select * from ab) ab where
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)
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1)
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
Filter: (b = (InitPlan 1).col1)
@ -2775,16 +2775,16 @@ select * from (select * from ab where a = 1 union all select * from ab) ab where
-- A case containing a UNION ALL with a non-partitioned child.
explain (analyze, costs off, summary off, timing off, buffers off)
select * from (select * from ab where a = 1 union all (values(10,5)) union all select * from ab) ab where b = (select 1);
QUERY PLAN
-------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
----------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
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)
-> Result (actual rows=1.00 loops=1)
-> Append (actual rows=0.00 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
Filter: (b = (InitPlan 1).col1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
Recheck Cond: (a = 1)
@ -2796,21 +2796,21 @@ select * from (select * from ab where a = 1 union all (values(10,5)) union all s
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)
-> Result (actual rows=0.00 loops=1)
One-Time Filter: (5 = (InitPlan 1).col1)
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1)
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1)
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1)
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
Filter: (b = (InitPlan 1).col1)
@ -2835,17 +2835,17 @@ union all
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q6(1);
QUERY PLAN
--------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 12
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on ab_a1_b1 ab_1 (never executed)
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
-> Seq Scan on xy_1 (actual rows=0 loops=1)
-> Seq Scan on xy_1 (actual rows=0.00 loops=1)
Filter: ((x = $1) AND (y = (InitPlan 1).col1))
Rows Removed by Filter: 1
-> Seq Scan on ab_a1_b1 ab_4 (never executed)
@ -2875,44 +2875,44 @@ deallocate ab_q6;
insert into ab values (1,2);
select explain_analyze('
update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a;');
explain_analyze
-------------------------------------------------------------------------------------------
Update on ab_a1 (actual rows=0 loops=1)
explain_analyze
----------------------------------------------------------------------------------------------
Update on ab_a1 (actual rows=0.00 loops=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
-> Nested Loop (actual rows=1 loops=1)
-> Append (actual rows=1 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_a1_1 (actual rows=0 loops=1)
-> Nested Loop (actual rows=1.00 loops=1)
-> Append (actual rows=1.00 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_a1_1 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_a1_2 (actual rows=1 loops=1)
-> Bitmap Heap Scan on ab_a1_b2 ab_a1_2 (actual rows=1.00 loops=1)
Recheck Cond: (a = 1)
Heap Blocks: exact=1
-> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1 loops=1)
-> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b3 ab_a1_3 (actual rows=0 loops=1)
-> Bitmap Heap Scan on ab_a1_b3 ab_a1_3 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
Heap Blocks: exact=1
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1.00 loops=1)
Index Cond: (a = 1)
-> Materialize (actual rows=1 loops=1)
-> Materialize (actual rows=1.00 loops=1)
Storage: Memory Maximum Storage: NkB
-> Append (actual rows=1 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1)
-> Append (actual rows=1.00 loops=1)
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1)
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (actual rows=1 loops=1)
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (actual rows=1.00 loops=1)
Recheck Cond: (a = 1)
Heap Blocks: exact=1
-> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1 loops=1)
-> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1.00 loops=1)
Index Cond: (a = 1)
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1)
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0.00 loops=1)
Recheck Cond: (a = 1)
Heap Blocks: exact=1
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1.00 loops=1)
Index Cond: (a = 1)
(37 rows)
@ -2927,23 +2927,23 @@ truncate ab;
insert into ab values (1, 1), (1, 2), (1, 3), (2, 1);
select explain_analyze('
update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);');
explain_analyze
------------------------------------------------------------------------------
Update on ab_a1 (actual rows=0 loops=1)
explain_analyze
---------------------------------------------------------------------------------
Update on ab_a1 (actual rows=0.00 loops=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
-> Result (actual rows=1 loops=1)
-> Nested Loop (actual rows=3 loops=1)
-> Append (actual rows=3 loops=1)
-> Seq Scan on ab_a1_b1 ab_a1_1 (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b2 ab_a1_2 (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b3 ab_a1_3 (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Nested Loop (actual rows=3.00 loops=1)
-> Append (actual rows=3.00 loops=1)
-> Seq Scan on ab_a1_b1 ab_a1_1 (actual rows=1.00 loops=1)
-> Seq Scan on ab_a1_b2 ab_a1_2 (actual rows=1.00 loops=1)
-> Seq Scan on ab_a1_b3 ab_a1_3 (actual rows=1.00 loops=1)
-> Materialize (actual rows=1.00 loops=3)
Storage: Memory Maximum Storage: NkB
-> Append (actual rows=1 loops=1)
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1)
-> Append (actual rows=1.00 loops=1)
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1.00 loops=1)
Filter: (b = (InitPlan 1).col1)
-> Seq Scan on ab_a2_b2 ab_a2_2 (never executed)
Filter: (b = (InitPlan 1).col1)
@ -2985,12 +2985,12 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 > tprt.col1;
QUERY PLAN
-----------------------------------------------------------------------------
Nested Loop (actual rows=6 loops=1)
-> Seq Scan on tbl1 (actual rows=2 loops=1)
Nested Loop (actual rows=6.00 loops=1)
-> Seq Scan on tbl1 (actual rows=2.00 loops=1)
-> Append (actual rows=3.00 loops=2)
-> Index Scan using tprt1_idx on tprt_1 (actual rows=2.00 loops=2)
Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=2 loops=1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=2.00 loops=1)
Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt3_idx on tprt_3 (never executed)
Index Cond: (col1 < tbl1.col1)
@ -3006,8 +3006,8 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 = tprt.col1;
QUERY PLAN
-----------------------------------------------------------------------------
Nested Loop (actual rows=2 loops=1)
-> Seq Scan on tbl1 (actual rows=2 loops=1)
Nested Loop (actual rows=2.00 loops=1)
-> Seq Scan on tbl1 (actual rows=2.00 loops=1)
-> Append (actual rows=1.00 loops=2)
-> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 = tbl1.col1)
@ -3051,8 +3051,8 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1;
QUERY PLAN
-----------------------------------------------------------------------------
Nested Loop (actual rows=23 loops=1)
-> Seq Scan on tbl1 (actual rows=5 loops=1)
Nested Loop (actual rows=23.00 loops=1)
-> Seq Scan on tbl1 (actual rows=5.00 loops=1)
-> Append (actual rows=4.60 loops=5)
-> Index Scan using tprt1_idx on tprt_1 (actual rows=2.00 loops=5)
Index Cond: (col1 < tbl1.col1)
@ -3072,8 +3072,8 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1;
QUERY PLAN
-----------------------------------------------------------------------------
Nested Loop (actual rows=3 loops=1)
-> Seq Scan on tbl1 (actual rows=5 loops=1)
Nested Loop (actual rows=3.00 loops=1)
-> Seq Scan on tbl1 (actual rows=5.00 loops=1)
-> Append (actual rows=0.60 loops=5)
-> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 = tbl1.col1)
@ -3134,11 +3134,11 @@ delete from tbl1;
insert into tbl1 values (4400);
explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 < tprt.col1;
QUERY PLAN
--------------------------------------------------------------------------
Nested Loop (actual rows=1 loops=1)
-> Seq Scan on tbl1 (actual rows=1 loops=1)
-> Append (actual rows=1 loops=1)
QUERY PLAN
-----------------------------------------------------------------------------
Nested Loop (actual rows=1.00 loops=1)
-> Seq Scan on tbl1 (actual rows=1.00 loops=1)
-> Append (actual rows=1.00 loops=1)
-> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 > tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (never executed)
@ -3149,7 +3149,7 @@ select * from tbl1 join tprt on tbl1.col1 < tprt.col1;
Index Cond: (col1 > tbl1.col1)
-> Index Scan using tprt5_idx on tprt_5 (never executed)
Index Cond: (col1 > tbl1.col1)
-> Index Scan using tprt6_idx on tprt_6 (actual rows=1 loops=1)
-> Index Scan using tprt6_idx on tprt_6 (actual rows=1.00 loops=1)
Index Cond: (col1 > tbl1.col1)
(15 rows)
@ -3168,9 +3168,9 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 = tprt.col1;
QUERY PLAN
-------------------------------------------------------------------
Nested Loop (actual rows=0 loops=1)
-> Seq Scan on tbl1 (actual rows=1 loops=1)
-> Append (actual rows=0 loops=1)
Nested Loop (actual rows=0.00 loops=1)
-> Seq Scan on tbl1 (actual rows=1.00 loops=1)
-> Append (actual rows=0.00 loops=1)
-> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (never executed)
@ -3205,9 +3205,9 @@ prepare part_abc_q1 (int, int, int) as
select * from part_abc where a = $1 and b = $2 and c = $3;
-- Single partition should be scanned.
explain (analyze, costs off, summary off, timing off, buffers off) execute part_abc_q1 (1, 2, 3);
QUERY PLAN
----------------------------------------------------------
Seq Scan on part_abc_p1 part_abc (actual rows=0 loops=1)
QUERY PLAN
-------------------------------------------------------------
Seq Scan on part_abc_p1 part_abc (actual rows=0.00 loops=1)
Filter: ((a = $1) AND (b = $2) AND (c = $3))
(2 rows)
@ -3230,28 +3230,28 @@ select * from listp where b = 1;
-- which match the given parameter.
prepare q1 (int,int) as select * from listp where b in ($1,$2);
explain (analyze, costs off, summary off, timing off, buffers off) execute q1 (1,1);
QUERY PLAN
-------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
----------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 1
-> Seq Scan on listp_1_1 listp_1 (actual rows=0 loops=1)
-> Seq Scan on listp_1_1 listp_1 (actual rows=0.00 loops=1)
Filter: (b = ANY (ARRAY[$1, $2]))
(4 rows)
explain (analyze, costs off, summary off, timing off, buffers off) execute q1 (2,2);
QUERY PLAN
-------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
----------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 1
-> Seq Scan on listp_2_1 listp_1 (actual rows=0 loops=1)
-> Seq Scan on listp_2_1 listp_1 (actual rows=0.00 loops=1)
Filter: (b = ANY (ARRAY[$1, $2]))
(4 rows)
-- Try with no matching partitions.
explain (analyze, costs off, summary off, timing off, buffers off) execute q1 (0,0);
QUERY PLAN
--------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
(2 rows)
@ -3262,17 +3262,17 @@ prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <>
explain (analyze, costs off, summary off, timing off, buffers off) execute q1 (1,2,2,0);
QUERY PLAN
-------------------------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 1
-> Seq Scan on listp_1_1 listp_1 (actual rows=0 loops=1)
-> Seq Scan on listp_1_1 listp_1 (actual rows=0.00 loops=1)
Filter: ((b = ANY (ARRAY[$1, $2])) AND ($3 <> b) AND ($4 <> b))
(4 rows)
-- Both partitions allowed by IN clause, then both excluded again by <> clauses.
explain (analyze, costs off, summary off, timing off, buffers off) execute q1 (1,2,2,1);
QUERY PLAN
--------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
(2 rows)
@ -3281,9 +3281,9 @@ explain (analyze, costs off, summary off, timing off, buffers off)
select * from listp where a = (select null::int);
QUERY PLAN
------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on listp_1_1 listp_1 (never executed)
Filter: (a = (InitPlan 1).col1)
-> Seq Scan on listp_2_1 listp_2 (never executed)
@ -3304,24 +3304,24 @@ create table stable_qual_pruning3 partition of stable_qual_pruning
-- comparison against a stable value requires run-time pruning
explain (analyze, costs off, summary off, timing off, buffers off)
select * from stable_qual_pruning where a < localtimestamp;
QUERY PLAN
--------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 1
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0.00 loops=1)
Filter: (a < LOCALTIMESTAMP)
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0.00 loops=1)
Filter: (a < LOCALTIMESTAMP)
(6 rows)
-- timestamp < timestamptz comparison is only stable, not immutable
explain (analyze, costs off, summary off, timing off, buffers off)
select * from stable_qual_pruning where a < '2000-02-01'::timestamptz;
QUERY PLAN
--------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0.00 loops=1)
Filter: (a < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone)
(4 rows)
@ -3329,9 +3329,9 @@ select * from stable_qual_pruning where a < '2000-02-01'::timestamptz;
explain (analyze, costs off, summary off, timing off, buffers off)
select * from stable_qual_pruning
where a = any(array['2010-02-01', '2020-01-01']::timestamp[]);
QUERY PLAN
--------------------------------
Result (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------
Result (actual rows=0.00 loops=1)
One-Time Filter: false
(2 rows)
@ -3340,7 +3340,7 @@ select * from stable_qual_pruning
where a = any(array['2000-02-01', '2010-01-01']::timestamp[]);
QUERY PLAN
----------------------------------------------------------------------------------------------------------------
Seq Scan on stable_qual_pruning2 stable_qual_pruning (actual rows=0 loops=1)
Seq Scan on stable_qual_pruning2 stable_qual_pruning (actual rows=0.00 loops=1)
Filter: (a = ANY ('{"Tue Feb 01 00:00:00 2000","Fri Jan 01 00:00:00 2010"}'::timestamp without time zone[]))
(2 rows)
@ -3349,18 +3349,18 @@ select * from stable_qual_pruning
where a = any(array['2000-02-01', localtimestamp]::timestamp[]);
QUERY PLAN
------------------------------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0.00 loops=1)
Filter: (a = ANY (ARRAY['Tue Feb 01 00:00:00 2000'::timestamp without time zone, LOCALTIMESTAMP]))
(4 rows)
explain (analyze, costs off, summary off, timing off, buffers off)
select * from stable_qual_pruning
where a = any(array['2010-02-01', '2020-01-01']::timestamptz[]);
QUERY PLAN
--------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------
Append (actual rows=0.00 loops=1)
Subplans Removed: 3
(2 rows)
@ -3369,23 +3369,23 @@ select * from stable_qual_pruning
where a = any(array['2000-02-01', '2010-01-01']::timestamptz[]);
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
Append (actual rows=0.00 loops=1)
Subplans Removed: 2
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0.00 loops=1)
Filter: (a = ANY ('{"Tue Feb 01 00:00:00 2000 PST","Fri Jan 01 00:00:00 2010 PST"}'::timestamp with time zone[]))
(4 rows)
explain (analyze, costs off, summary off, timing off, buffers off)
select * from stable_qual_pruning
where a = any(null::timestamptz[]);
QUERY PLAN
--------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
-> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0.00 loops=1)
Filter: (a = ANY (NULL::timestamp with time zone[]))
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0.00 loops=1)
Filter: (a = ANY (NULL::timestamp with time zone[]))
-> Seq Scan on stable_qual_pruning3 stable_qual_pruning_3 (actual rows=0 loops=1)
-> Seq Scan on stable_qual_pruning3 stable_qual_pruning_3 (actual rows=0.00 loops=1)
Filter: (a = ANY (NULL::timestamp with time zone[]))
(7 rows)
@ -3405,14 +3405,14 @@ create table mc3p2 partition of mc3p
insert into mc3p values (0, 1, 1), (1, 1, 1), (2, 1, 1);
explain (analyze, costs off, summary off, timing off, buffers off)
select * from mc3p where a < 3 and abs(b) = 1;
QUERY PLAN
--------------------------------------------------------
Append (actual rows=3 loops=1)
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1 loops=1)
QUERY PLAN
-----------------------------------------------------------
Append (actual rows=3.00 loops=1)
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1.00 loops=1)
Filter: ((a < 3) AND (abs(b) = 1))
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1 loops=1)
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1.00 loops=1)
Filter: ((a < 3) AND (abs(b) = 1))
-> Seq Scan on mc3p2 mc3p_3 (actual rows=1 loops=1)
-> Seq Scan on mc3p2 mc3p_3 (actual rows=1.00 loops=1)
Filter: ((a < 3) AND (abs(b) = 1))
(7 rows)
@ -3427,11 +3427,11 @@ explain (analyze, costs off, summary off, timing off, buffers off)
execute ps1(1);
QUERY PLAN
-------------------------------------------------------------
Append (actual rows=1 loops=1)
Append (actual rows=1.00 loops=1)
Subplans Removed: 2
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on mc3p1 mc3p_1 (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on mc3p1 mc3p_1 (actual rows=1.00 loops=1)
Filter: ((a = $1) AND (abs(b) < (InitPlan 1).col1))
(6 rows)
@ -3442,13 +3442,13 @@ explain (analyze, costs off, summary off, timing off, buffers off)
execute ps2(1);
QUERY PLAN
--------------------------------------------------------------
Append (actual rows=2 loops=1)
Append (actual rows=2.00 loops=1)
Subplans Removed: 1
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1.00 loops=1)
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1))
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1 loops=1)
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1.00 loops=1)
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1))
(8 rows)
@ -3462,29 +3462,29 @@ create table boolp_t partition of boolp for values in('t');
create table boolp_f partition of boolp for values in('f');
explain (analyze, costs off, summary off, timing off, buffers off)
select * from boolp where a = (select value from boolvalues where value);
QUERY PLAN
-----------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
--------------------------------------------------------------
Append (actual rows=0.00 loops=1)
InitPlan 1
-> Seq Scan on boolvalues (actual rows=1 loops=1)
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
Filter: value
Rows Removed by Filter: 1
-> Seq Scan on boolp_f boolp_1 (never executed)
Filter: (a = (InitPlan 1).col1)
-> Seq Scan on boolp_t boolp_2 (actual rows=0 loops=1)
-> Seq Scan on boolp_t boolp_2 (actual rows=0.00 loops=1)
Filter: (a = (InitPlan 1).col1)
(9 rows)
explain (analyze, costs off, summary off, timing off, buffers off)
select * from boolp where a = (select value from boolvalues where not value);
QUERY PLAN
-----------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
--------------------------------------------------------------
Append (actual rows=0.00 loops=1)
InitPlan 1
-> Seq Scan on boolvalues (actual rows=1 loops=1)
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
Filter: (NOT value)
Rows Removed by Filter: 1
-> Seq Scan on boolp_f boolp_1 (actual rows=0 loops=1)
-> Seq Scan on boolp_f boolp_1 (actual rows=0.00 loops=1)
Filter: (a = (InitPlan 1).col1)
-> Seq Scan on boolp_t boolp_2 (never executed)
Filter: (a = (InitPlan 1).col1)
@ -3505,15 +3505,15 @@ create index on ma_test (b);
analyze ma_test;
prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b;
explain (analyze, costs off, summary off, timing off, buffers off) execute mt_q1(15);
QUERY PLAN
-----------------------------------------------------------------------------------------
Merge Append (actual rows=2 loops=1)
QUERY PLAN
--------------------------------------------------------------------------------------------
Merge Append (actual rows=2.00 loops=1)
Sort Key: ma_test.b
Subplans Removed: 1
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_1 (actual rows=1 loops=1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_1 (actual rows=1.00 loops=1)
Filter: ((a >= $1) AND ((a % 10) = 5))
Rows Removed by Filter: 9
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_2 (actual rows=1 loops=1)
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_2 (actual rows=1.00 loops=1)
Filter: ((a >= $1) AND ((a % 10) = 5))
Rows Removed by Filter: 9
(9 rows)
@ -3526,12 +3526,12 @@ execute mt_q1(15);
(2 rows)
explain (analyze, costs off, summary off, timing off, buffers off) execute mt_q1(25);
QUERY PLAN
-----------------------------------------------------------------------------------------
Merge Append (actual rows=1 loops=1)
QUERY PLAN
--------------------------------------------------------------------------------------------
Merge Append (actual rows=1.00 loops=1)
Sort Key: ma_test.b
Subplans Removed: 2
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_1 (actual rows=1 loops=1)
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_1 (actual rows=1.00 loops=1)
Filter: ((a >= $1) AND ((a % 10) = 5))
Rows Removed by Filter: 9
(6 rows)
@ -3544,9 +3544,9 @@ execute mt_q1(25);
-- Ensure MergeAppend behaves correctly when no subplans match
explain (analyze, costs off, summary off, timing off, buffers off) execute mt_q1(35);
QUERY PLAN
--------------------------------------
Merge Append (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------
Merge Append (actual rows=0.00 loops=1)
Sort Key: ma_test.b
Subplans Removed: 3
(3 rows)
@ -3560,11 +3560,11 @@ deallocate mt_q1;
prepare mt_q2 (int) as select * from ma_test where a >= $1 order by b limit 1;
-- Ensure output list looks sane when the MergeAppend has no subplans.
explain (analyze, verbose, costs off, summary off, timing off, buffers off) execute mt_q2 (35);
QUERY PLAN
--------------------------------------------
Limit (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------------
Limit (actual rows=0.00 loops=1)
Output: ma_test.a, ma_test.b
-> Merge Append (actual rows=0 loops=1)
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: ma_test.b
Subplans Removed: 3
(5 rows)
@ -3572,21 +3572,21 @@ explain (analyze, verbose, costs off, summary off, timing off, buffers off) exec
deallocate mt_q2;
-- ensure initplan params properly prune partitions
explain (analyze, costs off, summary off, timing off, buffers off) select * from ma_test where a >= (select min(b) from ma_test_p2) order by b;
QUERY PLAN
-----------------------------------------------------------------------------------------------
Merge Append (actual rows=20 loops=1)
QUERY PLAN
--------------------------------------------------------------------------------------------------
Merge Append (actual rows=20.00 loops=1)
Sort Key: ma_test.b
InitPlan 2
-> Result (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
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)
-> Limit (actual rows=1.00 loops=1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1.00 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 >= (InitPlan 2).col1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10 loops=1)
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10.00 loops=1)
Filter: (a >= (InitPlan 2).col1)
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10 loops=1)
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10.00 loops=1)
Filter: (a >= (InitPlan 2).col1)
(14 rows)
@ -4023,9 +4023,9 @@ 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, buffers off)
select * from listp where a = (select 2) and b <> 10;
QUERY PLAN
---------------------------------------------------
Seq Scan on listp1 listp (actual rows=0 loops=1)
QUERY PLAN
-----------------------------------------------------
Seq Scan on listp1 listp (actual rows=0.00 loops=1)
Filter: ((b <> 10) AND (a = (InitPlan 1).col1))
InitPlan 1
-> Result (never executed)
@ -4148,22 +4148,22 @@ create index on rangep (a);
-- Ensure run-time pruning works on the nested Merge Append
explain (analyze on, costs off, timing off, summary off, buffers off)
select * from rangep where b IN((select 1),(select 2)) order by a;
QUERY PLAN
------------------------------------------------------------------------------------------------------------
Append (actual rows=0 loops=1)
QUERY PLAN
---------------------------------------------------------------------------------------------------------------
Append (actual rows=0.00 loops=1)
InitPlan 1
-> Result (actual rows=1 loops=1)
-> Result (actual rows=1.00 loops=1)
InitPlan 2
-> Result (actual rows=1 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Result (actual rows=1.00 loops=1)
-> Merge Append (actual rows=0.00 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)
-> Index Scan using rangep_0_to_100_1_a_idx on rangep_0_to_100_1 rangep_2 (actual rows=0.00 loops=1)
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
-> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0 loops=1)
-> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0.00 loops=1)
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
-> Index Scan using rangep_0_to_100_3_a_idx on rangep_0_to_100_3 rangep_4 (never executed)
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
-> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0 loops=1)
-> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0.00 loops=1)
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
(15 rows)