forked from openGauss-Ecosystem/openGauss-server
修改一些回归测试用例:explain (costs off)
This commit is contained in:
parent
9e9fe453bf
commit
e2be91e0c0
File diff suppressed because it is too large
Load Diff
|
@ -14,37 +14,37 @@ partition by range(id) (
|
|||
);
|
||||
insert into force_vector_partition values(generate_series(1, 10000), generate_series(1, 2000), generate_series(1, 5000));
|
||||
analyze force_vector_partition;
|
||||
explain (analyze on, timing off) select /*+ set(try_vector_engine_strategy force) */ id, val1*2, val2+val1 as val3 from force_vector_test where id < 5000 and val1 < 500 order by id limit 10;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
Row Adapter (cost=277.80..277.80 rows=10 width=13) (actual rows=10 loops=1)
|
||||
-> Vector Limit (cost=277.77..277.80 rows=10 width=13) (actual rows=10 loops=1)
|
||||
-> Vector Sort (cost=277.77..284.02 rows=2500 width=13) (actual rows=10 loops=1)
|
||||
explain (analyze on, timing off, costs off) select /*+ set(try_vector_engine_strategy force) */ id, val1*2, val2+val1 as val3 from force_vector_test where id < 5000 and val1 < 500 order by id limit 10;
|
||||
QUERY PLAN
|
||||
-----------------------------------------------------------------------------------
|
||||
Row Adapter (actual rows=10 loops=1)
|
||||
-> Vector Limit (actual rows=10 loops=1)
|
||||
-> Vector Sort (actual rows=10 loops=1)
|
||||
Sort Key: id
|
||||
Sort Method: top-N heapsort Memory: 4kB
|
||||
-> Vector Adapter(type: BATCH MODE) (cost=223.75..223.75 rows=2500 width=13) (actual rows=2495 loops=1)
|
||||
Sort Method: top-N heapsort Memory: 3kB
|
||||
-> Vector Adapter(type: BATCH MODE) (actual rows=2495 loops=1)
|
||||
Filter: ((id < 5000) AND (val1 < 500))
|
||||
Rows Removed by Filter: 7505
|
||||
-> Seq Scan on force_vector_test (cost=0.00..223.75 rows=2500 width=13) (actual rows=10000 loops=1)
|
||||
--?.*
|
||||
-> Seq Scan on force_vector_test (actual rows=10000 loops=1)
|
||||
--? Total runtime:.*
|
||||
(10 rows)
|
||||
|
||||
explain (analyze on, timing off) select /*+ set(try_vector_engine_strategy force) */ id, avg(val1), sum(val2) from force_vector_partition group by id order by id limit 10;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Row Adapter (cost=596.12..596.12 rows=10 width=76) (actual rows=10 loops=1)
|
||||
-> Vector Limit (cost=596.10..596.12 rows=10 width=76) (actual rows=10 loops=1)
|
||||
-> Vector Sort (cost=596.10..621.10 rows=10000 width=76) (actual rows=10 loops=1)
|
||||
explain (analyze on, timing off, costs off) select /*+ set(try_vector_engine_strategy force) */ id, avg(val1), sum(val2) from force_vector_partition group by id order by id limit 10;
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
Row Adapter (actual rows=10 loops=1)
|
||||
-> Vector Limit (actual rows=10 loops=1)
|
||||
-> Vector Sort (actual rows=10 loops=1)
|
||||
Sort Key: id
|
||||
Sort Method: top-N heapsort Memory: 5kB
|
||||
-> Vector Hash Aggregate (cost=255.00..380.00 rows=10000 width=76) (actual rows=10000 loops=1)
|
||||
Sort Method: top-N heapsort Memory: 3kB
|
||||
-> Vector Hash Aggregate (actual rows=10000 loops=1)
|
||||
Group By Key: id
|
||||
-> Vector Partition Iterator (cost=0.00..155.00 rows=10000 width=12) (actual rows=10000 loops=1)
|
||||
-> Vector Partition Iterator (actual rows=10000 loops=1)
|
||||
Iterations: 5
|
||||
-> Vector Adapter(type: BATCH MODE) (cost=155.00..155.00 rows=10000 width=12) (actual rows=10000 loops=5)
|
||||
-> Partitioned Seq Scan on force_vector_partition (cost=0.00..155.00 rows=10000 width=12) (actual rows=10000 loops=5)
|
||||
-> Vector Adapter(type: BATCH MODE) (actual rows=10000 loops=5)
|
||||
-> Partitioned Seq Scan on force_vector_partition (actual rows=10000 loops=5)
|
||||
Selected Partitions: 1..5
|
||||
--?.*
|
||||
--? Total runtime:.*
|
||||
(13 rows)
|
||||
|
||||
drop table force_vector_test;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,167 +14,167 @@ drop table if exists test_bypass_sq1;
|
|||
create table test_bypass_sq1(col1 int, col2 int, col3 text);
|
||||
create index itest_bypass_sq1 on test_bypass_sq1(col1,col2);
|
||||
-- bypass insert data
|
||||
explain insert into test_bypass_sq1 values (0,0,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sq1 values (0,0,'test_insert');
|
||||
insert into test_bypass_sq1 values (0,0,'test_insert');
|
||||
explain insert into test_bypass_sq1 values (0,1,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sq1 values (0,1,'test_insert');
|
||||
insert into test_bypass_sq1 values (0,1,'test_insert');
|
||||
explain insert into test_bypass_sq1 values (1,1,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sq1 values (1,1,'test_insert');
|
||||
insert into test_bypass_sq1 values (1,1,'test_insert');
|
||||
explain insert into test_bypass_sq1 values (1,2,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sq1 values (1,2,'test_insert');
|
||||
insert into test_bypass_sq1 values (1,2,'test_insert');
|
||||
explain insert into test_bypass_sq1 values (0,0,'test_insert2');
|
||||
explain (costs off) insert into test_bypass_sq1 values (0,0,'test_insert2');
|
||||
insert into test_bypass_sq1 values (0,0,'test_insert2');
|
||||
explain insert into test_bypass_sq1 values (2,2,'test_insert2');
|
||||
explain (costs off) insert into test_bypass_sq1 values (2,2,'test_insert2');
|
||||
insert into test_bypass_sq1 values (2,2,'test_insert2');
|
||||
explain insert into test_bypass_sq1 values (0,0,'test_insert3');
|
||||
explain (costs off) insert into test_bypass_sq1 values (0,0,'test_insert3');
|
||||
insert into test_bypass_sq1 values (0,0,'test_insert3');
|
||||
explain insert into test_bypass_sq1 values (3,3,'test_insert3');
|
||||
explain (costs off) insert into test_bypass_sq1 values (3,3,'test_insert3');
|
||||
insert into test_bypass_sq1 values (3,3,'test_insert3');
|
||||
explain insert into test_bypass_sq1(col1,col2) values (1,1);
|
||||
explain (costs off) insert into test_bypass_sq1(col1,col2) values (1,1);
|
||||
insert into test_bypass_sq1(col1,col2) values (1,1);
|
||||
explain insert into test_bypass_sq1(col1,col2) values (2,2);
|
||||
explain (costs off) insert into test_bypass_sq1(col1,col2) values (2,2);
|
||||
insert into test_bypass_sq1(col1,col2) values (2,2);
|
||||
explain insert into test_bypass_sq1(col1,col2) values (3,3);
|
||||
explain (costs off) insert into test_bypass_sq1(col1,col2) values (3,3);
|
||||
insert into test_bypass_sq1(col1,col2) values (3,3);
|
||||
explain insert into test_bypass_sq1 values (null,null,null);
|
||||
explain (costs off) insert into test_bypass_sq1 values (null,null,null);
|
||||
insert into test_bypass_sq1 values (null,null,null);
|
||||
--bypass
|
||||
set enable_indexonlyscan=off;
|
||||
explain select * from test_bypass_sq1 where col1=0 and col2=0;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 and col2=0;
|
||||
select * from test_bypass_sq1 where col1=0 and col2=0;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2;
|
||||
select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2 limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2 limit 1;
|
||||
select col1,col2 from test_bypass_sq1 where col1>0 and col2>0 order by col1,col2 limit 1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 1;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 limit 0;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 limit 0;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 0;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1,col2 for update limit 0;
|
||||
reset enable_indexonlyscan;
|
||||
--bypass though index only scan
|
||||
set enable_indexscan = off;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 1;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 0;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 0;
|
||||
reset enable_indexscan;
|
||||
--error
|
||||
explain select * from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit -1;
|
||||
explain select * from test_bypass_sq1 where col1=0 and col2=0 order by col1 for update limit -1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit -1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 and col2=0 order by col1 for update limit -1;
|
||||
--bypass
|
||||
explain update test_bypass_sq1 set col3='test_null' where col1 is null and col2 is null;
|
||||
explain (costs off) update test_bypass_sq1 set col3='test_null' where col1 is null and col2 is null;
|
||||
update test_bypass_sq1 set col3='test_null' where col1 is null and col2 is null;
|
||||
explain select * from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
select * from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1 is not null and col2 is not null order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1 is not null and col2 is not null order by col1,col2;
|
||||
select col1,col2 from test_bypass_sq1 where col1 is not null and col2 is not null order by col1,col2;
|
||||
explain select * from test_bypass_sq1 where col1 is not null and col2 = 0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1 is not null and col2 = 0 order by col1;
|
||||
select * from test_bypass_sq1 where col1 is not null and col2 = 0 order by col1;
|
||||
explain update test_bypass_sq1 set col2=col2-1,col3='test_update' where col1=0 and col2=0;
|
||||
explain (costs off) update test_bypass_sq1 set col2=col2-1,col3='test_update' where col1=0 and col2=0;
|
||||
update test_bypass_sq1 set col2=col2-1,col3='test_update' where col1=0 and col2=0;
|
||||
explain update test_bypass_sq1 set col2=col1 where col1=0 and col2=0;
|
||||
explain (costs off) update test_bypass_sq1 set col2=col1 where col1=0 and col2=0;
|
||||
update test_bypass_sq1 set col2=col1 where col1=0 and col2=0;
|
||||
explain update test_bypass_sq1 set col2=col1-1,col3='test_update' where col1=2 and col2=2;
|
||||
explain (costs off) update test_bypass_sq1 set col2=col1-1,col3='test_update' where col1=2 and col2=2;
|
||||
update test_bypass_sq1 set col2=col1-1,col3='test_update' where col1=2 and col2=2;
|
||||
explain select * from test_bypass_sq1 where col1=0 and col2=-1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 and col2=-1;
|
||||
select * from test_bypass_sq1 where col1=0 and col2=-1;
|
||||
--not bypass
|
||||
explain insert into test_bypass_sq1 values(0,generate_series(1,100),'test');
|
||||
explain select * from test_bypass_sq1 where col3 is not null;
|
||||
explain (costs off) insert into test_bypass_sq1 values(0,generate_series(1,100),'test');
|
||||
explain (costs off) select * from test_bypass_sq1 where col3 is not null;
|
||||
--bypass
|
||||
explain update test_bypass_sq1 set col2=mod(5,3) where col1=1 and col2=1;
|
||||
explain (costs off) update test_bypass_sq1 set col2=mod(5,3) where col1=1 and col2=1;
|
||||
update test_bypass_sq1 set col2=mod(5,3) where col1=1 and col2=1;
|
||||
--bypass / set enable_bitmapscan=off;
|
||||
explain update test_bypass_sq1 set col2=111,col3='test_update2' where col1=0;
|
||||
explain (costs off) update test_bypass_sq1 set col2=111,col3='test_update2' where col1=0;
|
||||
update test_bypass_sq1 set col2=111,col3='test_update2' where col1=0;
|
||||
explain select * from test_bypass_sq1 where col1=0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 order by col1;
|
||||
select * from test_bypass_sq1 where col1=0 order by col1;
|
||||
explain select * from test_bypass_sq1 where col2=2 order by col1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col2=2 order by col1;
|
||||
select * from test_bypass_sq1 where col2=2 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
select col1,col2 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
explain select * from test_bypass_sq1 where col1=0 order by col1 for update limit 2;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=0 order by col1 for update limit 2;
|
||||
select * from test_bypass_sq1 where col1=0 order by col1 for update limit 2;
|
||||
explain select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
explain select * from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
select * from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
explain select * from test_bypass_sq1 where col1=1 and col2=2 order by col1 for update limit 1;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=1 and col2=2 order by col1 for update limit 1;
|
||||
select * from test_bypass_sq1 where col1=1 and col2=2 order by col1 for update limit 1;
|
||||
--bypass though index only scan
|
||||
set enable_indexscan = off;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1=0 order by col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1=0 order by col2;
|
||||
select col1,col2 from test_bypass_sq1 where col1=0 order by col2;
|
||||
explain select col2,col1 from test_bypass_sq1 where col2=2 order by col1;
|
||||
explain (costs off) select col2,col1 from test_bypass_sq1 where col2=2 order by col1;
|
||||
select col2,col1 from test_bypass_sq1 where col2=2 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col1>0 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
select col1,col2 from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain select col2,col1 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
explain (costs off) select col2,col1 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
select col2,col1 from test_bypass_sq1 where col1>0 order by col1 limit 3;
|
||||
explain select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col2<5 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3;
|
||||
explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit null;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit null;
|
||||
select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit null;
|
||||
reset enable_indexscan;
|
||||
--not bypass
|
||||
explain select * from test_bypass_sq1 where col1>col2;
|
||||
explain select * from test_bypass_sq1 where col1=3 and col2=3 for update;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>col2;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1=3 and col2=3 for update;
|
||||
select * from test_bypass_sq1 where col1=3 and col2=3 for update;
|
||||
explain select * from test_bypass_sq1 where col3='test_update2';
|
||||
explain (costs off) select * from test_bypass_sq1 where col3='test_update2';
|
||||
--bypass
|
||||
explain select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 limit 3 offset 3;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 limit 3 offset 3;
|
||||
select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 limit 3 offset 3;
|
||||
select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 limit 3 offset 30;
|
||||
explain select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset 3;
|
||||
explain select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset null;
|
||||
explain select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset 30;
|
||||
explain select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 offset 3;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset 3;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset null;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset 30;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 offset 3;
|
||||
select * from test_bypass_sq1 where col1>0 and col2>0 order by col1 offset 3;
|
||||
select * from test_bypass_sq1 where col1>0 order by col1 for update limit 3 offset 30;
|
||||
explain select * from test_bypass_sq1 where col1>0 order by col1 for update offset 3;
|
||||
explain update test_bypass_sq1 set col2=3*7 where col1=3 and col2=2;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1>0 order by col1 for update offset 3;
|
||||
explain (costs off) update test_bypass_sq1 set col2=3*7 where col1=3 and col2=2;
|
||||
update test_bypass_sq1 set col2=3*7 where col1=3 and col2=2;
|
||||
explain delete from test_bypass_sq1 where col1=1 and col2=1;
|
||||
explain (costs off) delete from test_bypass_sq1 where col1=1 and col2=1;
|
||||
delete from test_bypass_sq1 where col1=1 and col2=1;
|
||||
explain delete from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain (costs off) delete from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
delete from test_bypass_sq1 where col1 is null and col2 is null;
|
||||
explain insert into test_bypass_sq1 values (null,null,null);
|
||||
explain (costs off) insert into test_bypass_sq1 values (null,null,null);
|
||||
insert into test_bypass_sq1 values (null,null,null);
|
||||
--bypass / set enable_bitmapscan=off;
|
||||
select * from test_bypass_sq1 where col1=3;
|
||||
explain select col1,col2 from test_bypass_sq1 order by col1 desc;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 order by col1 desc;
|
||||
select col1,col2 from test_bypass_sq1 order by col1 desc; --order by is supported when ordered col is in index
|
||||
explain select col1,col2 from test_bypass_sq1 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 order by col1;
|
||||
select col1,col2 from test_bypass_sq1 order by col1;
|
||||
--not bypass
|
||||
explain select col1,col2 from test_bypass_sq1 order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 order by col1,col2;
|
||||
select col1,col2 from test_bypass_sq1 order by col1,col2;
|
||||
explain select * from test_bypass_sq1 where col1 > 0 order by col1,col2 desc;
|
||||
explain (costs off) select * from test_bypass_sq1 where col1 > 0 order by col1,col2 desc;
|
||||
--bypass
|
||||
explain select col1,col2 from test_bypass_sq1 where col1 > 0 order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sq1 where col1 > 0 order by col1,col2;
|
||||
select col1,col2 from test_bypass_sq1 where col1 > 0 order by col1,col2;
|
||||
--not bypass
|
||||
explain select * from test_bypass_sq1 where true;
|
||||
explain (costs off) select * from test_bypass_sq1 where true;
|
||||
--bypass
|
||||
explain select col1, col2 from test_bypass_sq1 where true order by col1;
|
||||
explain (costs off) select col1, col2 from test_bypass_sq1 where true order by col1;
|
||||
select col1, col2 from test_bypass_sq1 where true order by col1;
|
||||
select col2, col1 from test_bypass_sq1 order by col1;
|
||||
select col1, col2 from test_bypass_sq1 order by col1 desc;
|
||||
explain insert into test_bypass_sq1 select * from test_bypass_sq1 where col1>0;
|
||||
explain (costs off) insert into test_bypass_sq1 select * from test_bypass_sq1 where col1>0;
|
||||
insert into test_bypass_sq1 select * from test_bypass_sq1 where col1>0;
|
||||
|
||||
--
|
||||
|
@ -182,48 +182,48 @@ drop table if exists test_bypass_sq2;
|
|||
create table test_bypass_sq2(col1 int not null, col2 int);
|
||||
create index itest_bypass_sq2 on test_bypass_sq2(col1);
|
||||
--bypass
|
||||
explain insert into test_bypass_sq2(col1) values (0);
|
||||
explain (costs off) insert into test_bypass_sq2(col1) values (0);
|
||||
insert into test_bypass_sq2(col1) values (0);
|
||||
--error
|
||||
explain insert into test_bypass_sq2(col1) values (null);
|
||||
explain (costs off) insert into test_bypass_sq2(col1) values (null);
|
||||
--bypass
|
||||
explain insert into test_bypass_sq2(col1,col2) values (1,1);
|
||||
explain (costs off) insert into test_bypass_sq2(col1,col2) values (1,1);
|
||||
insert into test_bypass_sq2(col1,col2) values (1,1);
|
||||
insert into test_bypass_sq2(col1,col2) values (3,3);
|
||||
insert into test_bypass_sq2(col1,col2) values (-1,-1);
|
||||
insert into test_bypass_sq2(col1,col2) values (1,1);
|
||||
insert into test_bypass_sq2(col1,col2) values (2,2);
|
||||
insert into test_bypass_sq2(col1,col2) values (3,3);
|
||||
explain insert into test_bypass_sq2(col1,col2) values (null,null);--error
|
||||
explain (costs off) insert into test_bypass_sq2(col1,col2) values (null,null);--error
|
||||
|
||||
--bypass
|
||||
set enable_indexonlyscan=off;
|
||||
explain update test_bypass_sq2 set col2 = col2+1 where col1 = 0;
|
||||
explain (costs off) update test_bypass_sq2 set col2 = col2+1 where col1 = 0;
|
||||
update test_bypass_sq2 set col2 = col2+1 where col1 = 0;
|
||||
explain select * from test_bypass_sq2 where col1 = 0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 = 0 order by col1;
|
||||
select * from test_bypass_sq2 where col1 = 0 order by col1;
|
||||
explain select * from test_bypass_sq2 where col1 >= 0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 >= 0 order by col1;
|
||||
select * from test_bypass_sq2 where col1 >= 0 order by col1;
|
||||
explain select * from test_bypass_sq2 where col1 >= 0 order by col1 limit 4;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 >= 0 order by col1 limit 4;
|
||||
select * from test_bypass_sq2 where col1 >= 0 order by col1 limit 4;
|
||||
explain select * from test_bypass_sq2 where col1 = 1 order by col1 for update limit 1;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 = 1 order by col1 for update limit 1;
|
||||
select * from test_bypass_sq2 where col1 = 1 order by col1 for update limit 1;
|
||||
explain select col1 from test_bypass_sq2 order by col1 limit 2;
|
||||
explain (costs off) select col1 from test_bypass_sq2 order by col1 limit 2;
|
||||
select col1 from test_bypass_sq2 order by col1 limit 2;
|
||||
explain select * from test_bypass_sq2 where col1 > 0 order by col1 limit 2 offset 2;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 > 0 order by col1 limit 2 offset 2;
|
||||
select * from test_bypass_sq2 where col1 > 0 order by col1 limit 2 offset 2;
|
||||
explain select * from test_bypass_sq2 where col1 > 0 order by col1 for update limit 2 offset 2;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 > 0 order by col1 for update limit 2 offset 2;
|
||||
reset enable_indexonlyscan;
|
||||
--not bypass
|
||||
explain select * from test_bypass_sq2 where col2 is null;
|
||||
explain select * from test_bypass_sq2 where col1 = 0 and col2 = 0;
|
||||
explain select t1.col3, t2.col2 from test_bypass_sq1 as t1 join test_bypass_sq2 as t2 on t1.col1=t2.col1;
|
||||
explain select count(*),col1 from test_bypass_sq1 group by col1;
|
||||
explain (costs off) select * from test_bypass_sq2 where col2 is null;
|
||||
explain (costs off) select * from test_bypass_sq2 where col1 = 0 and col2 = 0;
|
||||
explain (costs off) select t1.col3, t2.col2 from test_bypass_sq1 as t1 join test_bypass_sq2 as t2 on t1.col1=t2.col1;
|
||||
explain (costs off) select count(*),col1 from test_bypass_sq1 group by col1;
|
||||
--bypass (order by is supported when ordered col is in index)
|
||||
select col1 from test_bypass_sq2 order by col1 desc;
|
||||
select col1 from test_bypass_sq2 order by col1;
|
||||
--not bypass
|
||||
explain select * from test_bypass_sq2 order by col1,col2;
|
||||
explain (costs off) select * from test_bypass_sq2 order by col1,col2;
|
||||
--
|
||||
drop table if exists test_bypass_sq3;
|
||||
create table test_bypass_sq3(col1 int default 1, col2 int, col3 timestamp);
|
||||
|
@ -235,8 +235,8 @@ insert into test_bypass_sq3(col2,col3) values(1,default);
|
|||
insert into test_bypass_sq3 values(2,3,null);
|
||||
insert into test_bypass_sq3 values (3,3,null);
|
||||
--not bypass
|
||||
explain insert into test_bypass_sq3 values(3,3,current_timestamp);
|
||||
explain select * from test_bypass_sq3 where col1 = 1 order by col2;
|
||||
explain (costs off) insert into test_bypass_sq3 values(3,3,current_timestamp);
|
||||
explain (costs off) select * from test_bypass_sq3 where col1 = 1 order by col2;
|
||||
--bypass
|
||||
select * from test_bypass_sq3 where col1 = 1 limit 1;
|
||||
select col2 from test_bypass_sq3 where col1 = 1 for update;
|
||||
|
@ -261,19 +261,19 @@ insert into test_bypass_sq4 values (55,55,null);
|
|||
insert into test_bypass_sq4 values (55,null,55);
|
||||
insert into test_bypass_sq4 values (55,null,null);
|
||||
insert into test_bypass_sq4 values (null,null,null);
|
||||
explain select col3, col1, col2 from test_bypass_sq4 where col2 >22 order by 1,3;
|
||||
explain (costs off) select col3, col1, col2 from test_bypass_sq4 where col2 >22 order by 1,3;
|
||||
select col3, col1, col2 from test_bypass_sq4 where col2 >22 order by 1,3;
|
||||
explain select * from test_bypass_sq4 where col2 =22 and col3= 32 order by col2;
|
||||
explain (costs off) select * from test_bypass_sq4 where col2 =22 and col3= 32 order by col2;
|
||||
select * from test_bypass_sq4 where col2 =22 and col3= 32 order by col2;
|
||||
explain select col3,col2,col3 from test_bypass_sq4 where col3 >= 33 and col2 >= 22 order by col3,col2;
|
||||
explain (costs off) select col3,col2,col3 from test_bypass_sq4 where col3 >= 33 and col2 >= 22 order by col3,col2;
|
||||
select col3,col2,col3 from test_bypass_sq4 where col3 >= 33 and col2 >= 22 order by col3,col2;
|
||||
select col2,col3,col2 from test_bypass_sq4 where col3 >= 34 and col2 >= 22 order by col3,col2;
|
||||
explain select col3,col2,col3 from test_bypass_sq4 where col3 >= 33 and col2 >= 22 order by col3 for update;
|
||||
explain select col2,col3,col2 from test_bypass_sq4 where col3 >= 34 and col2 >= 22 order by col3,col2 for update;
|
||||
explain (costs off) select col3,col2,col3 from test_bypass_sq4 where col3 >= 33 and col2 >= 22 order by col3 for update;
|
||||
explain (costs off) select col2,col3,col2 from test_bypass_sq4 where col3 >= 34 and col2 >= 22 order by col3,col2 for update;
|
||||
select col2,col3,col2 from test_bypass_sq4 where col3 is null and col2 is null order by col3,col2;
|
||||
explain select col2,col3 from test_bypass_sq4 where col3 is null and col2 is not null;
|
||||
explain (costs off) select col2,col3 from test_bypass_sq4 where col3 is null and col2 is not null;
|
||||
select col2,col3 from test_bypass_sq4 where col3 is null and col2 is not null;
|
||||
explain select col2,col3 from test_bypass_sq4 where col3 is not null order by col3 desc,col2 desc;
|
||||
explain (costs off) select col2,col3 from test_bypass_sq4 where col3 is not null order by col3 desc,col2 desc;
|
||||
select col2,col3 from test_bypass_sq4 where col3 is not null order by col3 desc,col2 desc;
|
||||
|
||||
drop table if exists test_bypass_sq5;
|
||||
|
@ -351,7 +351,7 @@ create type complextype AS (f1 int, f2 text);
|
|||
create table test_bypass_sq6(col1 int, col2 complextype,col3 text);
|
||||
create index itest_bypass_sq6 on test_bypass_sq6(col1,col3);
|
||||
--not bypass
|
||||
explain insert into test_bypass_sq6 values (1,ROW(1, 'Simon1'::text),'test'::text);
|
||||
explain (costs off) insert into test_bypass_sq6 values (1,ROW(1, 'Simon1'::text),'test'::text);
|
||||
-- just insert
|
||||
reset opfusion_debug_mode;
|
||||
insert into test_bypass_sq6 values (1,ROW(1, 'Simon1'::text),'test'::text);
|
||||
|
@ -365,7 +365,7 @@ select col1 from test_bypass_sq6;
|
|||
select col3 from test_bypass_sq6 order by col1,col3;
|
||||
select col1, col3 from test_bypass_sq6 where true;
|
||||
--notbypass
|
||||
explain update test_bypass_sq6 set col2=ROW(2,'Ruby2'::text) where col1 = 1;
|
||||
explain (costs off) update test_bypass_sq6 set col2=ROW(2,'Ruby2'::text) where col1 = 1;
|
||||
--bypass
|
||||
delete from test_bypass_sq6 where col1 = 1;
|
||||
--test QPS
|
||||
|
@ -403,10 +403,10 @@ create table test_bypass_sq8(col1 int, col2 int, col3 text);
|
|||
create index itest_bypass_sq8 on test_bypass_sq8(col1,col2);
|
||||
create trigger tri_bypass after insert on test_bypass_sq8 for each row execute procedure tri_bypass();
|
||||
insert into test_bypass_sq8 values(1,1,'test');
|
||||
explain select * from test_bypass_sq8 where col1 = 1;
|
||||
explain update test_bypass_sq8 set col2 = 2 where col1 = 1;
|
||||
explain delete test_bypass_sq8 where col1 = 1;
|
||||
explain insert into test_bypass_sq8 values(2,2,'testinsert');
|
||||
explain (costs off) select * from test_bypass_sq8 where col1 = 1;
|
||||
explain (costs off) update test_bypass_sq8 set col2 = 2 where col1 = 1;
|
||||
explain (costs off) delete test_bypass_sq8 where col1 = 1;
|
||||
explain (costs off) insert into test_bypass_sq8 values(2,2,'testinsert');
|
||||
set opfusion_debug_mode=off;
|
||||
RESET SESSION AUTHORIZATION;
|
||||
SELECT node_name,select_count, update_count, insert_count, delete_count, ddl_count, dml_count FROM pgxc_sql_count where user_name='qps' order by node_name;
|
||||
|
@ -425,7 +425,7 @@ CREATE OR REPLACE RULE v_delete as ON DELETE TO v_test DO INSTEAD NOTHING;
|
|||
delete from v_test;
|
||||
|
||||
set explain_perf_mode=pretty;
|
||||
explain delete from v_test;
|
||||
explain (costs off) delete from v_test;
|
||||
reset explain_perf_mode;
|
||||
|
||||
drop table test cascade;
|
||||
|
|
|
@ -15,8 +15,8 @@ partition by range(id) (
|
|||
insert into force_vector_partition values(generate_series(1, 10000), generate_series(1, 2000), generate_series(1, 5000));
|
||||
analyze force_vector_partition;
|
||||
|
||||
explain (analyze on, timing off) select /*+ set(try_vector_engine_strategy force) */ id, val1*2, val2+val1 as val3 from force_vector_test where id < 5000 and val1 < 500 order by id limit 10;
|
||||
explain (analyze on, timing off) select /*+ set(try_vector_engine_strategy force) */ id, avg(val1), sum(val2) from force_vector_partition group by id order by id limit 10;
|
||||
explain (analyze on, timing off, costs off) select /*+ set(try_vector_engine_strategy force) */ id, val1*2, val2+val1 as val3 from force_vector_test where id < 5000 and val1 < 500 order by id limit 10;
|
||||
explain (analyze on, timing off, costs off) select /*+ set(try_vector_engine_strategy force) */ id, avg(val1), sum(val2) from force_vector_partition group by id order by id limit 10;
|
||||
|
||||
drop table force_vector_test;
|
||||
drop schema test_force_vector2 cascade;
|
||||
|
|
|
@ -22,33 +22,33 @@ partition test_bypass_sql_partition_8 values less than(80)
|
|||
);
|
||||
create index itest_bypass_sql_partition on test_bypass_sql_partition(col1,col2) local;
|
||||
--insert
|
||||
explain insert into test_bypass_sql_partition values (0,0,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (0,0,'test_insert');
|
||||
insert into test_bypass_sql_partition values (0,0,'test_insert');
|
||||
explain insert into test_bypass_sql_partition values (0,1,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (0,1,'test_insert');
|
||||
insert into test_bypass_sql_partition values (0,1,'test_insert');
|
||||
explain insert into test_bypass_sql_partition values (11,1,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (11,1,'test_insert');
|
||||
insert into test_bypass_sql_partition values (11,1,'test_insert');
|
||||
explain insert into test_bypass_sql_partition values (11,2,'test_insert');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (11,2,'test_insert');
|
||||
insert into test_bypass_sql_partition values (11,2,'test_insert');
|
||||
explain insert into test_bypass_sql_partition values (0,10,'test_insert2');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (0,10,'test_insert2');
|
||||
insert into test_bypass_sql_partition values (0,10,'test_insert2');
|
||||
explain insert into test_bypass_sql_partition values (2,12,'test_insert2');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (2,12,'test_insert2');
|
||||
insert into test_bypass_sql_partition values (2,12,'test_insert2');
|
||||
explain insert into test_bypass_sql_partition values (30,0,'test_insert3');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (30,0,'test_insert3');
|
||||
insert into test_bypass_sql_partition values (30,0,'test_insert3');
|
||||
explain insert into test_bypass_sql_partition values (3,3,'test_insert3');
|
||||
explain (costs off) insert into test_bypass_sql_partition values (3,3,'test_insert3');
|
||||
insert into test_bypass_sql_partition values (3,3,'test_insert3');
|
||||
explain insert into test_bypass_sql_partition(col1,col2) values (1,1);
|
||||
explain (costs off) insert into test_bypass_sql_partition(col1,col2) values (1,1);
|
||||
insert into test_bypass_sql_partition(col1,col2) values (1,1);
|
||||
explain insert into test_bypass_sql_partition(col1,col2) values (22,2);
|
||||
explain (costs off) insert into test_bypass_sql_partition(col1,col2) values (22,2);
|
||||
insert into test_bypass_sql_partition(col1,col2) values (22,2);
|
||||
explain insert into test_bypass_sql_partition(col1,col2) values (33,3);
|
||||
explain (costs off) insert into test_bypass_sql_partition(col1,col2) values (33,3);
|
||||
insert into test_bypass_sql_partition(col1,col2) values (33,3);
|
||||
--error
|
||||
explain insert into test_bypass_sql_partition values (null,null,null);
|
||||
explain (costs off) insert into test_bypass_sql_partition values (null,null,null);
|
||||
insert into test_bypass_sql_partition values (null,null,null);
|
||||
--nobypass
|
||||
explain insert into test_bypass_sql_partition values(0,generate_series(1,100),'test');
|
||||
explain (costs off) insert into test_bypass_sql_partition values(0,generate_series(1,100),'test');
|
||||
insert into test_bypass_sql_partition values(0,generate_series(1,100),'test');
|
||||
--select
|
||||
drop table if exists test_bypass_sql_partition;
|
||||
|
@ -68,90 +68,90 @@ create index itest_bypass_sql_partition on test_bypass_sql_partition(col1,col2)
|
|||
insert into test_bypass_sql_partition select generate_series(0,79,1), generate_series(0,100,10), repeat('a',7);
|
||||
--bypass
|
||||
set enable_indexonlyscan=off;
|
||||
explain select * from test_bypass_sql_partition where col1=0 and col2=0;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 and col2=0;
|
||||
select * from test_bypass_sql_partition where col1=0 and col2=0;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 and col2 <= 20 order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 and col2 <= 20 order by col1,col2;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 and col2 <= 20 order by col1,col2;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 1;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 1;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 for update limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 for update limit 1;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 for update limit 1;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 0;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>10 and col1<20 and col2>0 order by col1,col2 limit 0;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=0 order by col1,col2 for update limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1=10 and col2=0 order by col1,col2 for update limit 0;
|
||||
select col1,col2 from test_bypass_sql_partition where col1=10 and col2=0 order by col1,col2 for update limit 0;
|
||||
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1 is not null and col2 is not null order by col1,col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1 is not null and col2 is not null order by col1,col2;
|
||||
select col1,col2 from test_bypass_sql_partition where col1 is not null and col2 is not null order by col1,col2;
|
||||
explain select * from test_bypass_sql_partition where col1 is not null and col2 = 0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1 is not null and col2 = 0 order by col1;
|
||||
select * from test_bypass_sql_partition where col1 is not null and col2 = 0 order by col1;
|
||||
explain select * from test_bypass_sql_partition where col1=0 and col2=-1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 and col2=-1;
|
||||
select * from test_bypass_sql_partition where col1=0 and col2=-1;
|
||||
reset enable_indexonlyscan;
|
||||
--bypass though index only scan
|
||||
set enable_indexscan = off;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 1;
|
||||
select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 1;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 0;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 0;
|
||||
select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 0;
|
||||
reset enable_indexscan;
|
||||
--error
|
||||
explain select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 limit -1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 limit -1;
|
||||
select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 limit -1;
|
||||
explain select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 for update limit -1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 for update limit -1;
|
||||
select * from test_bypass_sql_partition where col1=0 and col2=0 order by col1 for update limit -1;
|
||||
--nobypass
|
||||
explain select * from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
select * from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
select col1, col2 from test_bypass_sql_partition where col1 <= 30 and col1 >= 10 order by col1 limit 10;
|
||||
explain select col1, col2 from test_bypass_sql_partition where col1 <= 30 and col1 >= 10 order by col1 limit 10;
|
||||
explain (costs off) select col1, col2 from test_bypass_sql_partition where col1 <= 30 and col1 >= 10 order by col1 limit 10;
|
||||
select col1, col2 from test_bypass_sql_partition order by col1 limit 10;
|
||||
explain select col1, col2 from test_bypass_sql_partition order by col1 limit 10;
|
||||
explain (costs off) select col1, col2 from test_bypass_sql_partition order by col1 limit 10;
|
||||
select col1, col2 from test_bypass_sql_partition where col1 > 0 order by col1 limit 10;
|
||||
explain select col1, col2 from test_bypass_sql_partition where col1 > 0 order by col1 limit 10;
|
||||
explain (costs off) select col1, col2 from test_bypass_sql_partition where col1 > 0 order by col1 limit 10;
|
||||
select col1, col2 from test_bypass_sql_partition where col1 < 20 order by col1 limit 10;
|
||||
explain select col1, col2 from test_bypass_sql_partition where col1 < 20 order by col1 limit 10;
|
||||
explain (costs off) select col1, col2 from test_bypass_sql_partition where col1 < 20 order by col1 limit 10;
|
||||
|
||||
--update
|
||||
--bypass
|
||||
|
||||
explain update test_bypass_sql_partition set col2=col2-1,col3='test_update' where col1=0 and col2=0;
|
||||
explain (costs off) update test_bypass_sql_partition set col2=col2-1,col3='test_update' where col1=0 and col2=0;
|
||||
update test_bypass_sql_partition set col2=col2-1,col3='test_update' where col1=10 and col2=0;
|
||||
explain update test_bypass_sql_partition set col2=col1-1,col3='test_update' where col1=20 and col2=2;
|
||||
explain (costs off) update test_bypass_sql_partition set col2=col1-1,col3='test_update' where col1=20 and col2=2;
|
||||
update test_bypass_sql_partition set col2=col1-1,col3='test_update' where col1=20 and col2=2;
|
||||
explain update test_bypass_sql_partition set col2=mod(5,3) where col1=1 and col2=10;
|
||||
explain (costs off) update test_bypass_sql_partition set col2=mod(5,3) where col1=1 and col2=10;
|
||||
update test_bypass_sql_partition set col2=mod(5,3) where col1=1 and col2=10;
|
||||
--not bypass
|
||||
explain insert into test_bypass_sql_partition values(0,generate_series(1,100),'test');
|
||||
explain select * from test_bypass_sql_partition where col3 is not null;
|
||||
explain update test_bypass_sql_partition set col3='test_null' where col1 is null and col2 is null;
|
||||
explain (costs off) insert into test_bypass_sql_partition values(0,generate_series(1,100),'test');
|
||||
explain (costs off) select * from test_bypass_sql_partition where col3 is not null;
|
||||
explain (costs off) update test_bypass_sql_partition set col3='test_null' where col1 is null and col2 is null;
|
||||
update test_bypass_sql_partition set col3='test_null' where col1 is null and col2 is null;
|
||||
|
||||
|
||||
--bypass
|
||||
explain update test_bypass_sql_partition set col2=111,col3='test_update2' where col1=0;
|
||||
explain (costs off) update test_bypass_sql_partition set col2=111,col3='test_update2' where col1=0;
|
||||
update test_bypass_sql_partition set col2=111,col3='test_update2' where col1=0;
|
||||
explain select * from test_bypass_sql_partition where col1=0 order by col1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 order by col1;
|
||||
select * from test_bypass_sql_partition where col1=0 order by col1;
|
||||
explain select * from test_bypass_sql_partition where col1=0 order by col1 for update limit 2;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=0 order by col1 for update limit 2;
|
||||
select * from test_bypass_sql_partition where col1=0 order by col1 for update limit 2;
|
||||
explain select * from test_bypass_sql_partition where col1=1 and col2=20 order by col1 for update limit 1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=1 and col2=20 order by col1 for update limit 1;
|
||||
select * from test_bypass_sql_partition where col1=1 and col2=20 order by col1 for update limit 1;
|
||||
|
||||
--nobypass
|
||||
explain select * from test_bypass_sql_partition where col2=20 order by col1;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col2=20 order by col1;
|
||||
select * from test_bypass_sql_partition where col2=20 order by col1;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 10;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 3;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 3;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 order by col1 limit 3;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col2<50 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col2<50 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col2<50 order by col1 limit 10;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 10;
|
||||
explain select * from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 3;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 3;
|
||||
select * from test_bypass_sql_partition where col1>=0 and col2>0 order by col1 limit 3;
|
||||
|
||||
|
||||
|
@ -173,74 +173,74 @@ insert into test_bypass_sql_partition select generate_series(0,79,1), generate_s
|
|||
|
||||
--bypass though index only scan
|
||||
set enable_indexscan = off;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1=0 order by col2;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1=0 order by col2;
|
||||
select col1,col2 from test_bypass_sql_partition where col1=0 order by col2;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10;
|
||||
explain select col2,col1 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 3;
|
||||
explain (costs off) select col2,col1 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 3;
|
||||
select col2,col1 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 3;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit 3;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit 3;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit 3;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit null;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit null;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit null;
|
||||
--nobypass
|
||||
explain select col2,col1 from test_bypass_sql_partition where col2=2 order by col1 limit 10;
|
||||
explain (costs off) select col2,col1 from test_bypass_sql_partition where col2=2 order by col1 limit 10;
|
||||
select col2,col1 from test_bypass_sql_partition where col2=2 order by col1 limit 10;
|
||||
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1 is null and col2 is null limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1 is null and col2 is null limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1 is null and col2 is null limit 10;
|
||||
|
||||
explain select col1,col2 from test_bypass_sql_partition where col2<5 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col2<5 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col2<5 order by col1 limit 10;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<=10 and col2>0 order by col1 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<=10 and col2>0 order by col1 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<=10 and col2>0 order by col1 limit 10;
|
||||
|
||||
reset enable_indexscan;
|
||||
|
||||
--nobypass
|
||||
explain select * from test_bypass_sql_partition where col1>col2 limit 10;
|
||||
explain select * from test_bypass_sql_partition where col1=3 and col2=3 for update;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>col2 limit 10;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1=3 and col2=3 for update;
|
||||
select * from test_bypass_sql_partition where col1=3 and col2=3 for update;
|
||||
explain select * from test_bypass_sql_partition where col3='test_update2';
|
||||
explain (costs off) select * from test_bypass_sql_partition where col3='test_update2';
|
||||
|
||||
explain select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 limit 3 offset 3;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 limit 3 offset 3;
|
||||
select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 limit 3 offset 3;
|
||||
explain select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update limit 3 offset 3;
|
||||
explain select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update limit 3 offset null;
|
||||
explain select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 offset 3;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update limit 3 offset 3;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update limit 3 offset null;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 offset 3;
|
||||
select * from test_bypass_sql_partition where col1>0 and col1<10 and col2>0 order by col1 offset 3;
|
||||
explain select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update offset 3;
|
||||
explain update test_bypass_sql_partition set col2=3*7 where col1=3 and col2=2;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1>0 and col1<10 order by col1 for update offset 3;
|
||||
explain (costs off) update test_bypass_sql_partition set col2=3*7 where col1=3 and col2=2;
|
||||
update test_bypass_sql_partition set col2=3*7 where col1=3 and col2=2;
|
||||
explain delete from test_bypass_sql_partition where col1=1 and col2=1;
|
||||
explain (costs off) delete from test_bypass_sql_partition where col1=1 and col2=1;
|
||||
delete from test_bypass_sql_partition where col1=1 and col2=1;
|
||||
--error
|
||||
explain delete from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
explain (costs off) delete from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
delete from test_bypass_sql_partition where col1 is null and col2 is null;
|
||||
explain insert into test_bypass_sql_partition values (null,null,null);
|
||||
explain (costs off) insert into test_bypass_sql_partition values (null,null,null);
|
||||
insert into test_bypass_sql_partition values (null,null,null);
|
||||
--bypass / set enable_bitmapscan=off;
|
||||
select * from test_bypass_sql_partition where col1=3;
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 desc;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 desc;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10 desc; --order by is supported when ordered col is in index
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 limit 10 order by col1;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 limit 10 order by col1;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 limit 10 order by col1;
|
||||
--not bypass
|
||||
explain select col1,col2 from test_bypass_sql_partition order by col1,col2 limit 10;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition order by col1,col2 limit 10;
|
||||
select col1,col2 from test_bypass_sql_partition order by col1,col2 limit 10;
|
||||
explain select * from test_bypass_sql_partition where col1 > 0 order by col1,col2 desc limit 10;
|
||||
explain (costs off) select * from test_bypass_sql_partition where col1 > 0 order by col1,col2 desc limit 10;
|
||||
--bypass
|
||||
explain select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1,col2 limit 10 ;
|
||||
explain (costs off) select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1,col2 limit 10 ;
|
||||
select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1,col2 limit 10;
|
||||
--not bypass
|
||||
explain select * from test_bypass_sql_partition where true;
|
||||
explain select col1, col2 from test_bypass_sql_partition where true order by col1 limit 10;
|
||||
explain (costs off) select * from test_bypass_sql_partition where true;
|
||||
explain (costs off) select col1, col2 from test_bypass_sql_partition where true order by col1 limit 10;
|
||||
select col1, col2 from test_bypass_sql_partition where true order by col1 limit 10;
|
||||
--bypass
|
||||
|
||||
select col2, col1 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10;
|
||||
select col1, col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 desc limit 10;
|
||||
explain insert into test_bypass_sql_partition select * from test_bypass_sql_partition where col1=0;
|
||||
explain (costs off) insert into test_bypass_sql_partition select * from test_bypass_sql_partition where col1=0;
|
||||
|
||||
delete from test_bypass_sql_partition where col1=1;
|
||||
delete from test_bypass_sql_partition where col1 > 10 and col1 < 0;
|
||||
|
|
Loading…
Reference in New Issue