Commit d52eaa09 authored by Tom Lane's avatar Tom Lane

Rely on plan_cache_mode to force generic plans in partition_prune test.

This file had a very weird mix of tests that did "set plan_cache_mode =
force_generic_plan" to get a generic plan, and tests that relied on
using five dummy executions of a prepared statement.  Converting them
all to rely on plan_cache_mode is more consistent and shaves off a
noticeable fraction of the test script's runtime.

Discussion: https://postgr.es/m/11952.1569536725@sss.pgh.pa.us
parent 863fa43e
-- --
-- Test partitioning planner code -- Test partitioning planner code
-- --
-- Force generic plans to be used for all prepared statements in this file.
set plan_cache_mode = force_generic_plan;
create table lp (a char) partition by list (a); create table lp (a char) partition by list (a);
create table lp_default partition of lp default; create table lp_default partition of lp default;
create table lp_ef partition of lp for values in ('e', 'f'); create table lp_ef partition of lp for values in ('e', 'f');
...@@ -1715,33 +1717,6 @@ create table ab_a3_b3 partition of ab_a3 for values in (3); ...@@ -1715,33 +1717,6 @@ create table ab_a3_b3 partition of ab_a3 for values in (3);
set enable_indexonlyscan = off; set enable_indexonlyscan = off;
prepare ab_q1 (int, int, int) as prepare ab_q1 (int, int, int) as
select * from ab where a between $1 and $2 and b <= $3; select * from ab where a between $1 and $2 and b <= $3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q1 (1, 8, 3);
a | b
---+---
(0 rows)
execute ab_q1 (1, 8, 3);
a | b
---+---
(0 rows)
execute ab_q1 (1, 8, 3);
a | b
---+---
(0 rows)
execute ab_q1 (1, 8, 3);
a | b
---+---
(0 rows)
execute ab_q1 (1, 8, 3);
a | b
---+---
(0 rows)
explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3); explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3);
QUERY PLAN QUERY PLAN
--------------------------------------------------------- ---------------------------------------------------------
...@@ -1778,33 +1753,6 @@ deallocate ab_q1; ...@@ -1778,33 +1753,6 @@ deallocate ab_q1;
-- Runtime pruning after optimizer pruning -- Runtime pruning after optimizer pruning
prepare ab_q1 (int, int) as prepare ab_q1 (int, int) as
select a from ab where a between $1 and $2 and b < 3; select a from ab where a between $1 and $2 and b < 3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q1 (1, 8);
a
---
(0 rows)
execute ab_q1 (1, 8);
a
---
(0 rows)
execute ab_q1 (1, 8);
a
---
(0 rows)
execute ab_q1 (1, 8);
a
---
(0 rows)
execute ab_q1 (1, 8);
a
---
(0 rows)
explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2);
QUERY PLAN QUERY PLAN
------------------------------------------------------- -------------------------------------------------------
...@@ -1835,31 +1783,6 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4); ...@@ -1835,31 +1783,6 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4);
-- different levels of partitioning. -- different levels of partitioning.
prepare ab_q2 (int, int) as prepare ab_q2 (int, int) as
select a from ab where a between $1 and $2 and b < (select 3); select a from ab where a between $1 and $2 and b < (select 3);
execute ab_q2 (1, 8);
a
---
(0 rows)
execute ab_q2 (1, 8);
a
---
(0 rows)
execute ab_q2 (1, 8);
a
---
(0 rows)
execute ab_q2 (1, 8);
a
---
(0 rows)
execute ab_q2 (1, 8);
a
---
(0 rows)
explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2);
QUERY PLAN QUERY PLAN
-------------------------------------------------------- --------------------------------------------------------
...@@ -1878,31 +1801,6 @@ explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2); ...@@ -1878,31 +1801,6 @@ explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2);
-- As above, but swap the PARAM_EXEC Param to the first partition level -- As above, but swap the PARAM_EXEC Param to the first partition level
prepare ab_q3 (int, int) as prepare ab_q3 (int, int) as
select a from ab where b between $1 and $2 and a < (select 3); select a from ab where b between $1 and $2 and a < (select 3);
execute ab_q3 (1, 8);
a
---
(0 rows)
execute ab_q3 (1, 8);
a
---
(0 rows)
execute ab_q3 (1, 8);
a
---
(0 rows)
execute ab_q3 (1, 8);
a
---
(0 rows)
execute ab_q3 (1, 8);
a
---
(0 rows)
explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2);
QUERY PLAN QUERY PLAN
-------------------------------------------------------- --------------------------------------------------------
...@@ -2021,38 +1919,6 @@ set parallel_setup_cost = 0; ...@@ -2021,38 +1919,6 @@ set parallel_setup_cost = 0;
set parallel_tuple_cost = 0; set parallel_tuple_cost = 0;
set min_parallel_table_scan_size = 0; set min_parallel_table_scan_size = 0;
set max_parallel_workers_per_gather = 2; set max_parallel_workers_per_gather = 2;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q4 (1, 8);
avg
-----
(1 row)
execute ab_q4 (1, 8);
avg
-----
(1 row)
execute ab_q4 (1, 8);
avg
-----
(1 row)
execute ab_q4 (1, 8);
avg
-----
(1 row)
execute ab_q4 (1, 8);
avg
-----
(1 row)
select explain_parallel_append('execute ab_q4 (2, 2)'); select explain_parallel_append('execute ab_q4 (2, 2)');
explain_parallel_append explain_parallel_append
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -2074,38 +1940,6 @@ select explain_parallel_append('execute ab_q4 (2, 2)'); ...@@ -2074,38 +1940,6 @@ select explain_parallel_append('execute ab_q4 (2, 2)');
-- Test run-time pruning with IN lists. -- Test run-time pruning with IN lists.
prepare ab_q5 (int, int, int) as prepare ab_q5 (int, int, int) as
select avg(a) from ab where a in($1,$2,$3) and b < 4; select avg(a) from ab where a in($1,$2,$3) and b < 4;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q5 (1, 2, 3);
avg
-----
(1 row)
execute ab_q5 (1, 2, 3);
avg
-----
(1 row)
execute ab_q5 (1, 2, 3);
avg
-----
(1 row)
execute ab_q5 (1, 2, 3);
avg
-----
(1 row)
execute ab_q5 (1, 2, 3);
avg
-----
(1 row)
select explain_parallel_append('execute ab_q5 (1, 1, 1)'); select explain_parallel_append('execute ab_q5 (1, 1, 1)');
explain_parallel_append explain_parallel_append
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -2530,7 +2364,6 @@ create table xy_1 (x int, y int); ...@@ -2530,7 +2364,6 @@ create table xy_1 (x int, y int);
insert into xy_1 values(100,-10); insert into xy_1 values(100,-10);
set enable_bitmapscan = 0; set enable_bitmapscan = 0;
set enable_indexscan = 0; set enable_indexscan = 0;
set plan_cache_mode = 'force_generic_plan';
prepare ab_q6 as prepare ab_q6 as
select * from ( select * from (
select tableoid::regclass,a,b from ab select tableoid::regclass,a,b from ab
...@@ -2573,7 +2406,6 @@ execute ab_q6(100); ...@@ -2573,7 +2406,6 @@ execute ab_q6(100);
reset enable_bitmapscan; reset enable_bitmapscan;
reset enable_indexscan; reset enable_indexscan;
reset plan_cache_mode;
deallocate ab_q1; deallocate ab_q1;
deallocate ab_q2; deallocate ab_q2;
deallocate ab_q3; deallocate ab_q3;
...@@ -2956,33 +2788,6 @@ alter table part_bac attach partition part_cab for values in(2); ...@@ -2956,33 +2788,6 @@ alter table part_bac attach partition part_cab for values in(2);
alter table part_cab attach partition part_abc_p1 for values in(3); alter table part_cab attach partition part_abc_p1 for values in(3);
prepare part_abc_q1 (int, int, int) as prepare part_abc_q1 (int, int, int) as
select * from part_abc where a = $1 and b = $2 and c = $3; select * from part_abc where a = $1 and b = $2 and c = $3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute part_abc_q1 (1, 2, 3);
a | b | c
---+---+---
(0 rows)
execute part_abc_q1 (1, 2, 3);
a | b | c
---+---+---
(0 rows)
execute part_abc_q1 (1, 2, 3);
a | b | c
---+---+---
(0 rows)
execute part_abc_q1 (1, 2, 3);
a | b | c
---+---+---
(0 rows)
execute part_abc_q1 (1, 2, 3);
a | b | c
---+---+---
(0 rows)
-- Single partition should be scanned. -- Single partition should be scanned.
explain (analyze, costs off, summary off, timing off) execute part_abc_q1 (1, 2, 3); explain (analyze, costs off, summary off, timing off) execute part_abc_q1 (1, 2, 3);
QUERY PLAN QUERY PLAN
...@@ -3009,31 +2814,6 @@ select * from listp where b = 1; ...@@ -3009,31 +2814,6 @@ select * from listp where b = 1;
-- partitions before finally detecting the correct set of 2nd level partitions -- partitions before finally detecting the correct set of 2nd level partitions
-- which match the given parameter. -- which match the given parameter.
prepare q1 (int,int) as select * from listp where b in ($1,$2); prepare q1 (int,int) as select * from listp where b in ($1,$2);
execute q1 (1,2);
a | b
---+---
(0 rows)
execute q1 (1,2);
a | b
---+---
(0 rows)
execute q1 (1,2);
a | b
---+---
(0 rows)
execute q1 (1,2);
a | b
---+---
(0 rows)
execute q1 (1,2);
a | b
---+---
(0 rows)
explain (analyze, costs off, summary off, timing off) execute q1 (1,1); explain (analyze, costs off, summary off, timing off) execute q1 (1,1);
QUERY PLAN QUERY PLAN
----------------------------------------------------- -----------------------------------------------------
...@@ -3066,31 +2846,6 @@ explain (analyze, costs off, summary off, timing off) execute q1 (0,0); ...@@ -3066,31 +2846,6 @@ explain (analyze, costs off, summary off, timing off) execute q1 (0,0);
deallocate q1; deallocate q1;
-- Test more complex cases where a not-equal condition further eliminates partitions. -- Test more complex cases where a not-equal condition further eliminates partitions.
prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <> b and $4 <> b; prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <> b and $4 <> b;
execute q1 (1,2,3,4);
a | b
---+---
(0 rows)
execute q1 (1,2,3,4);
a | b
---+---
(0 rows)
execute q1 (1,2,3,4);
a | b
---+---
(0 rows)
execute q1 (1,2,3,4);
a | b
---+---
(0 rows)
execute q1 (1,2,3,4);
a | b
---+---
(0 rows)
-- Both partitions allowed by IN clause, but one disallowed by <> clause -- Both partitions allowed by IN clause, but one disallowed by <> clause
explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0); explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0);
QUERY PLAN QUERY PLAN
...@@ -3259,7 +3014,6 @@ select * from mc3p where a < 3 and abs(b) = 1; ...@@ -3259,7 +3014,6 @@ select * from mc3p where a < 3 and abs(b) = 1;
-- a combination of runtime parameters is specified, not all of whose values -- a combination of runtime parameters is specified, not all of whose values
-- are available at the same time -- are available at the same time
-- --
set plan_cache_mode = force_generic_plan;
prepare ps1 as prepare ps1 as
select * from mc3p where a = $1 and abs(b) < (select 3); select * from mc3p where a = $1 and abs(b) < (select 3);
explain (analyze, costs off, summary off, timing off) explain (analyze, costs off, summary off, timing off)
...@@ -3292,7 +3046,6 @@ execute ps2(1); ...@@ -3292,7 +3046,6 @@ execute ps2(1);
(8 rows) (8 rows)
deallocate ps2; deallocate ps2;
reset plan_cache_mode;
drop table mc3p; drop table mc3p;
-- Ensure runtime pruning works with initplans params with boolean types -- Ensure runtime pruning works with initplans params with boolean types
create table boolvalues (value bool not null); create table boolvalues (value bool not null);
...@@ -3344,48 +3097,6 @@ insert into ma_test select x,x from generate_series(0,29) t(x); ...@@ -3344,48 +3097,6 @@ insert into ma_test select x,x from generate_series(0,29) t(x);
create index on ma_test (b); create index on ma_test (b);
analyze ma_test; analyze ma_test;
prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b; prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute mt_q1(0);
a
----
5
15
25
(3 rows)
execute mt_q1(0);
a
----
5
15
25
(3 rows)
execute mt_q1(0);
a
----
5
15
25
(3 rows)
execute mt_q1(0);
a
----
5
15
25
(3 rows)
execute mt_q1(0);
a
----
5
15
25
(3 rows)
explain (analyze, costs off, summary off, timing off) execute mt_q1(15); explain (analyze, costs off, summary off, timing off) execute mt_q1(15);
QUERY PLAN QUERY PLAN
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -3857,7 +3568,6 @@ from ( ...@@ -3857,7 +3568,6 @@ from (
select 1, 1, 1 select 1, 1, 1
) s(a, b, c) ) s(a, b, c)
where s.a = $1 and s.b = $2 and s.c = (select 1); where s.a = $1 and s.b = $2 and s.c = (select 1);
set plan_cache_mode to force_generic_plan;
explain (costs off) execute q (1, 1); explain (costs off) execute q (1, 1);
QUERY PLAN QUERY PLAN
--------------------------------------------------------------- ---------------------------------------------------------------
...@@ -3879,7 +3589,6 @@ execute q (1, 1); ...@@ -3879,7 +3589,6 @@ execute q (1, 1);
1 | 1 | 1 1 | 1 | 1
(1 row) (1 row)
reset plan_cache_mode;
drop table p, q; drop table p, q;
-- Ensure run-time pruning works correctly when we match a partitioned table -- Ensure run-time pruning works correctly when we match a partitioned table
-- on the first level but find no matching partitions on the second level. -- on the first level but find no matching partitions on the second level.
......
-- --
-- Test partitioning planner code -- Test partitioning planner code
-- --
-- Force generic plans to be used for all prepared statements in this file.
set plan_cache_mode = force_generic_plan;
create table lp (a char) partition by list (a); create table lp (a char) partition by list (a);
create table lp_default partition of lp default; create table lp_default partition of lp default;
create table lp_ef partition of lp for values in ('e', 'f'); create table lp_ef partition of lp for values in ('e', 'f');
...@@ -355,14 +359,6 @@ set enable_indexonlyscan = off; ...@@ -355,14 +359,6 @@ set enable_indexonlyscan = off;
prepare ab_q1 (int, int, int) as prepare ab_q1 (int, int, int) as
select * from ab where a between $1 and $2 and b <= $3; select * from ab where a between $1 and $2 and b <= $3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q1 (1, 8, 3);
execute ab_q1 (1, 8, 3);
execute ab_q1 (1, 8, 3);
execute ab_q1 (1, 8, 3);
execute ab_q1 (1, 8, 3);
explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3); explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3);
explain (analyze, costs off, summary off, timing off) execute ab_q1 (1, 2, 3); explain (analyze, costs off, summary off, timing off) execute ab_q1 (1, 2, 3);
...@@ -372,14 +368,6 @@ deallocate ab_q1; ...@@ -372,14 +368,6 @@ deallocate ab_q1;
prepare ab_q1 (int, int) as prepare ab_q1 (int, int) as
select a from ab where a between $1 and $2 and b < 3; select a from ab where a between $1 and $2 and b < 3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q1 (1, 8);
execute ab_q1 (1, 8);
execute ab_q1 (1, 8);
execute ab_q1 (1, 8);
execute ab_q1 (1, 8);
explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2);
explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4); explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4);
...@@ -388,24 +376,12 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4); ...@@ -388,24 +376,12 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4);
prepare ab_q2 (int, int) as prepare ab_q2 (int, int) as
select a from ab where a between $1 and $2 and b < (select 3); select a from ab where a between $1 and $2 and b < (select 3);
execute ab_q2 (1, 8);
execute ab_q2 (1, 8);
execute ab_q2 (1, 8);
execute ab_q2 (1, 8);
execute ab_q2 (1, 8);
explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2);
-- As above, but swap the PARAM_EXEC Param to the first partition level -- As above, but swap the PARAM_EXEC Param to the first partition level
prepare ab_q3 (int, int) as prepare ab_q3 (int, int) as
select a from ab where b between $1 and $2 and a < (select 3); select a from ab where b between $1 and $2 and a < (select 3);
execute ab_q3 (1, 8);
execute ab_q3 (1, 8);
execute ab_q3 (1, 8);
execute ab_q3 (1, 8);
execute ab_q3 (1, 8);
explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2); explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2);
-- Test a backwards Append scan -- Test a backwards Append scan
...@@ -485,27 +461,12 @@ set parallel_tuple_cost = 0; ...@@ -485,27 +461,12 @@ set parallel_tuple_cost = 0;
set min_parallel_table_scan_size = 0; set min_parallel_table_scan_size = 0;
set max_parallel_workers_per_gather = 2; set max_parallel_workers_per_gather = 2;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q4 (1, 8);
execute ab_q4 (1, 8);
execute ab_q4 (1, 8);
execute ab_q4 (1, 8);
execute ab_q4 (1, 8);
select explain_parallel_append('execute ab_q4 (2, 2)'); select explain_parallel_append('execute ab_q4 (2, 2)');
-- Test run-time pruning with IN lists. -- Test run-time pruning with IN lists.
prepare ab_q5 (int, int, int) as prepare ab_q5 (int, int, int) as
select avg(a) from ab where a in($1,$2,$3) and b < 4; select avg(a) from ab where a in($1,$2,$3) and b < 4;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute ab_q5 (1, 2, 3);
execute ab_q5 (1, 2, 3);
execute ab_q5 (1, 2, 3);
execute ab_q5 (1, 2, 3);
execute ab_q5 (1, 2, 3);
select explain_parallel_append('execute ab_q5 (1, 1, 1)'); select explain_parallel_append('execute ab_q5 (1, 1, 1)');
select explain_parallel_append('execute ab_q5 (2, 3, 3)'); select explain_parallel_append('execute ab_q5 (2, 3, 3)');
...@@ -579,7 +540,6 @@ insert into xy_1 values(100,-10); ...@@ -579,7 +540,6 @@ insert into xy_1 values(100,-10);
set enable_bitmapscan = 0; set enable_bitmapscan = 0;
set enable_indexscan = 0; set enable_indexscan = 0;
set plan_cache_mode = 'force_generic_plan';
prepare ab_q6 as prepare ab_q6 as
select * from ( select * from (
...@@ -598,7 +558,6 @@ execute ab_q6(100); ...@@ -598,7 +558,6 @@ execute ab_q6(100);
reset enable_bitmapscan; reset enable_bitmapscan;
reset enable_indexscan; reset enable_indexscan;
reset plan_cache_mode;
deallocate ab_q1; deallocate ab_q1;
deallocate ab_q2; deallocate ab_q2;
...@@ -712,14 +671,6 @@ alter table part_cab attach partition part_abc_p1 for values in(3); ...@@ -712,14 +671,6 @@ alter table part_cab attach partition part_abc_p1 for values in(3);
prepare part_abc_q1 (int, int, int) as prepare part_abc_q1 (int, int, int) as
select * from part_abc where a = $1 and b = $2 and c = $3; select * from part_abc where a = $1 and b = $2 and c = $3;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute part_abc_q1 (1, 2, 3);
execute part_abc_q1 (1, 2, 3);
execute part_abc_q1 (1, 2, 3);
execute part_abc_q1 (1, 2, 3);
execute part_abc_q1 (1, 2, 3);
-- Single partition should be scanned. -- Single partition should be scanned.
explain (analyze, costs off, summary off, timing off) execute part_abc_q1 (1, 2, 3); explain (analyze, costs off, summary off, timing off) execute part_abc_q1 (1, 2, 3);
...@@ -741,12 +692,6 @@ select * from listp where b = 1; ...@@ -741,12 +692,6 @@ select * from listp where b = 1;
-- which match the given parameter. -- which match the given parameter.
prepare q1 (int,int) as select * from listp where b in ($1,$2); prepare q1 (int,int) as select * from listp where b in ($1,$2);
execute q1 (1,2);
execute q1 (1,2);
execute q1 (1,2);
execute q1 (1,2);
execute q1 (1,2);
explain (analyze, costs off, summary off, timing off) execute q1 (1,1); explain (analyze, costs off, summary off, timing off) execute q1 (1,1);
explain (analyze, costs off, summary off, timing off) execute q1 (2,2); explain (analyze, costs off, summary off, timing off) execute q1 (2,2);
...@@ -760,12 +705,6 @@ deallocate q1; ...@@ -760,12 +705,6 @@ deallocate q1;
-- Test more complex cases where a not-equal condition further eliminates partitions. -- Test more complex cases where a not-equal condition further eliminates partitions.
prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <> b and $4 <> b; prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <> b and $4 <> b;
execute q1 (1,2,3,4);
execute q1 (1,2,3,4);
execute q1 (1,2,3,4);
execute q1 (1,2,3,4);
execute q1 (1,2,3,4);
-- Both partitions allowed by IN clause, but one disallowed by <> clause -- Both partitions allowed by IN clause, but one disallowed by <> clause
explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0); explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0);
...@@ -842,7 +781,6 @@ select * from mc3p where a < 3 and abs(b) = 1; ...@@ -842,7 +781,6 @@ select * from mc3p where a < 3 and abs(b) = 1;
-- a combination of runtime parameters is specified, not all of whose values -- a combination of runtime parameters is specified, not all of whose values
-- are available at the same time -- are available at the same time
-- --
set plan_cache_mode = force_generic_plan;
prepare ps1 as prepare ps1 as
select * from mc3p where a = $1 and abs(b) < (select 3); select * from mc3p where a = $1 and abs(b) < (select 3);
explain (analyze, costs off, summary off, timing off) explain (analyze, costs off, summary off, timing off)
...@@ -853,7 +791,6 @@ prepare ps2 as ...@@ -853,7 +791,6 @@ prepare ps2 as
explain (analyze, costs off, summary off, timing off) explain (analyze, costs off, summary off, timing off)
execute ps2(1); execute ps2(1);
deallocate ps2; deallocate ps2;
reset plan_cache_mode;
drop table mc3p; drop table mc3p;
...@@ -888,14 +825,6 @@ create index on ma_test (b); ...@@ -888,14 +825,6 @@ create index on ma_test (b);
analyze ma_test; analyze ma_test;
prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b; prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b;
-- Execute query 5 times to allow choose_custom_plan
-- to start considering a generic plan.
execute mt_q1(0);
execute mt_q1(0);
execute mt_q1(0);
execute mt_q1(0);
execute mt_q1(0);
explain (analyze, costs off, summary off, timing off) execute mt_q1(15); explain (analyze, costs off, summary off, timing off) execute mt_q1(15);
execute mt_q1(15); execute mt_q1(15);
explain (analyze, costs off, summary off, timing off) execute mt_q1(25); explain (analyze, costs off, summary off, timing off) execute mt_q1(25);
...@@ -1075,12 +1004,9 @@ from ( ...@@ -1075,12 +1004,9 @@ from (
) s(a, b, c) ) s(a, b, c)
where s.a = $1 and s.b = $2 and s.c = (select 1); where s.a = $1 and s.b = $2 and s.c = (select 1);
set plan_cache_mode to force_generic_plan;
explain (costs off) execute q (1, 1); explain (costs off) execute q (1, 1);
execute q (1, 1); execute q (1, 1);
reset plan_cache_mode;
drop table p, q; drop table p, q;
-- Ensure run-time pruning works correctly when we match a partitioned table -- Ensure run-time pruning works correctly when we match a partitioned table
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment