1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31003: Second execution for ps-protocol

This patch adds for "--ps-protocol" second execution
of queries "SELECT".
Also in this patch it is added ability to disable/enable
(--disable_ps2_protocol/--enable_ps2_protocol) second
execution for "--ps-prototocol" in testcases.
This commit is contained in:
Lena Startseva
2023-05-31 11:57:45 +07:00
parent 23dae6173c
commit 9854fb6fa7
400 changed files with 1339 additions and 42 deletions

View File

@ -22,6 +22,7 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1);
--echo * Test subquery as top item in different clauses
--echo *
--echo #single value subquery test (SELECT list)
--disable_ps2_protocol
flush status;
select a, (select d from t2 where b=c) from t1;
@ -341,7 +342,7 @@ flush status;
select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
--enable_ps2_protocol
--echo #clean up
drop table t1,t2;
@ -421,6 +422,7 @@ DROP TABLE t1;
--echo #uncacheable queries test (random and side effect)
--disable_ps2_protocol
flush status;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (2), (4), (1), (3);
@ -431,6 +433,7 @@ show status like "subquery_cache%";
select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext;
show status like "subquery_cache%";
drop table t1;
--enable_ps2_protocol
--echo #test of sql_big_tables switch and outer table reference in subquery with grouping
set big_tables=1;
@ -456,6 +459,7 @@ insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5),
(3,5), (100,3), (200,3), (10,6), (20,6), (20,7), (100,8), (200,8);
insert into t2 values (1,1),(3,3),(20,20);
--disable_ps2_protocol
--echo aggregate function as parameter of subquery
set optimizer_switch='subquery_cache=off';
flush status;
@ -480,6 +484,7 @@ flush status;
select max(a), (select a from t2 where a=c) from t1 group by b;
show status like "subquery_cache%";
show status like '%Handler_read%';
--enable_ps2_protocol
drop table t1,t2;
@ -494,6 +499,7 @@ insert into t1 values
create table t2 (pk int, a int, primary key(pk));
insert into t2 select a,a from t0;
--disable_ps2_protocol
set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on';
flush status;
select * from t1 where a in (select pk from t2);
@ -525,6 +531,7 @@ flush status;
select * from t1 where a in (select pk from t2);
show status like "subquery_cache%";
show status like '%Handler_read%';
--enable_ps2_protocol
drop table t0,t1,t2;
@ -1308,6 +1315,7 @@ CREATE TABLE `t4` (
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
INSERT INTO `t4` VALUES (100,2,5,'2001-07-26','2001-07-26','11:49:25','11:49:25','2007-04-25 05:08:49','2007-04-25 05:08:49','f','f');
--disable_ps2_protocol
SET @@optimizer_switch = 'subquery_cache=off';
/* cache is off */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
@ -1325,6 +1333,7 @@ FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_nokey` field10
FROM t4 table1 JOIN ( t1 table2 STRAIGHT_JOIN t1 table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
GROUP BY field10 ;
--enable_ps2_protocol
drop table t1,t2,t3,t4;
set @@optimizer_switch= default;