mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-31933: Make working view-protocol + ps-protocol (running two protocols together)
Fix for v. 10.5
This commit is contained in:
parent
d046b13e7b
commit
090cecd5e8
11 changed files with 139 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
|||
--echo # MDEV-30660 COUNT DISTINCT seems unnecessarily slow when run on a PK
|
||||
--echo #
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
set @save_optimizer_trace = @@optimizer_trace;
|
||||
SET optimizer_trace='enabled=on';
|
||||
let $trace=
|
||||
|
@ -104,6 +106,8 @@ eval $trace;
|
|||
DROP TABLE t1, t2, t3;
|
||||
DROP VIEW v1;
|
||||
SET optimizer_trace = @save_optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # end of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -23,10 +23,13 @@ SET
|
|||
|
||||
SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select
|
||||
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
|
||||
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
|
||||
drop table t1;
|
||||
|
|
|
@ -258,6 +258,8 @@ where t1.col2 in
|
|||
|
||||
# the having column is resolved in the FROM clause of the outer query -
|
||||
# works in ANSI
|
||||
#Enable after fix MDEV-31937
|
||||
--disable_ps2_protocol
|
||||
select t1.col1 from t1
|
||||
where t1.col2 in
|
||||
(select t2.col2 from t2
|
||||
|
@ -284,6 +286,7 @@ where t1.col2 in
|
|||
group by t2.col1, t2.col2 having col_t1 <= 10)
|
||||
group by col_t1
|
||||
having col_t1 <= 20;
|
||||
--enable_ps2_protocol
|
||||
|
||||
#
|
||||
# nested HAVING clauses
|
||||
|
@ -412,11 +415,14 @@ INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
|
|||
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
|
||||
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
|
||||
|
||||
#Enable after fix MDEV-31937
|
||||
--disable_ps2_protocol
|
||||
SELECT EMPNUM, GRADE*1000
|
||||
FROM HU.STAFF WHERE GRADE * 1000 >
|
||||
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
|
||||
GROUP BY CITY, PTYPE
|
||||
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
|
||||
--enable_ps2_protocol
|
||||
|
||||
DROP SCHEMA HU;
|
||||
USE test;
|
||||
|
@ -956,6 +962,8 @@ DROP TABLE t;
|
|||
--echo # MDEV-29731 Crash when HAVING in a correlated subquery references
|
||||
--echo # columns in the outer query
|
||||
--echo #
|
||||
#Enable after fix MDEV-29731
|
||||
--disable_view_protocol
|
||||
CREATE TABLE t (a INT, b INT);
|
||||
SELECT 1 FROM t
|
||||
WHERE b = (SELECT 1 FROM t GROUP BY a HAVING b = a+1);
|
||||
|
@ -998,6 +1006,7 @@ UPDATE t SET a = ''
|
|||
WHERE (0, a) IN ((0,-1),(+1,0))
|
||||
ORDER BY 1+AVG(a) OVER (ORDER BY a)) ORDER BY a;
|
||||
DROP TABLE t;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
|
|
|
@ -77,7 +77,9 @@ analyze table t1;
|
|||
analyze table t2;
|
||||
|
||||
explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1,t2,t0;
|
||||
|
||||
--echo #
|
||||
|
@ -104,7 +106,9 @@ INSERT INTO t1(a) SELECT a FROM t1;
|
|||
|
||||
analyze table t1;
|
||||
EXPLAIN SELECT DISTINCT a FROM t1;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
|
@ -114,7 +118,9 @@ CREATE TABLE t1 (a INT, b INT, c int, d int, KEY(a,b,c,d));
|
|||
INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (1,0,1,1), (3,2,3,3), (4,5,4,4);
|
||||
ANALYZE TABLE t1;
|
||||
EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (id INT NOT NULL, a DATE, KEY(id,a));
|
||||
|
@ -128,9 +134,13 @@ INSERT INTO t1 values (1,'2001-01-01'),(1,'2001-01-02'),
|
|||
(4,'2001-01-03'),(4,'2001-01-04');
|
||||
set optimizer_trace='enabled=on';
|
||||
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
|
@ -159,7 +169,9 @@ update t1 set b=2 where pk between 0 and 20;
|
|||
analyze table t1;
|
||||
set optimizer_trace='enabled=on';
|
||||
explain select * from t1 where a=1 and b=2 order by c limit 1;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1,ten,one_k;
|
||||
|
||||
--echo #
|
||||
|
@ -185,15 +197,21 @@ analyze table t3;
|
|||
--echo # table t2 should be eliminated
|
||||
explain
|
||||
select t1.a from t1 left join t2 on t1.a=t2.a;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo # no tables should be eliminated
|
||||
explain select * from t1 left join t2 on t2.a=t1.a;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo # multiple tables are eliminated
|
||||
explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t0, t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
|
@ -218,7 +236,9 @@ analyze table t1,t10;
|
|||
|
||||
set optimizer_trace='enabled=on';
|
||||
explain extended select * from t1 where a in (select pk from t10);
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t0,t1,t11,t10,t12,t2;
|
||||
|
||||
--echo #
|
||||
|
@ -244,7 +264,9 @@ set @@optimizer_use_condition_selectivity=4;
|
|||
set @@use_stat_tables= PREFERABLY;
|
||||
set optimizer_trace='enabled=on';
|
||||
explain select * from t1 where pk = 2 and a=5 and b=1;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set @@use_stat_tables= @save_use_stat_tables;
|
||||
drop table t0,t1;
|
||||
|
@ -321,7 +343,9 @@ alter table t0 add key(a);
|
|||
|
||||
set optimizer_trace=1;
|
||||
explain delete from t0 where t0.a<3;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
drop table ten,t0;
|
||||
set optimizer_trace='enabled=off';
|
||||
|
||||
|
@ -338,7 +362,9 @@ alter table t0 add key(a);
|
|||
create table t1 like t0;
|
||||
insert into t1 select * from t0;
|
||||
explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
drop table ten,t0,t1;
|
||||
set optimizer_trace='enabled=off';
|
||||
|
||||
|
@ -350,7 +376,9 @@ set optimizer_trace=1;
|
|||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
explain select * from (select rand() from t1)q;
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
set optimizer_trace='enabled=off';
|
||||
|
||||
|
@ -365,6 +393,7 @@ create table t2(a int);
|
|||
insert into t2 values (1),(2),(3),(1),(2),(3),(1),(2),(3);
|
||||
set @save_optimizer_switch= @@optimizer_switch;
|
||||
explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_inner_2);
|
||||
--disable_view_protocol
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
--echo # with Firstmatch, mostly for tracing fix_semijoin_strategies_for_picked_join_order
|
||||
|
@ -377,6 +406,7 @@ set optimizer_switch='materialization=on';
|
|||
explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and
|
||||
t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4);
|
||||
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
set @@optimizer_switch= @save_optimizer_switch;
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -405,11 +435,14 @@ create table t1 ( a int, b int, key a_b(a,b));
|
|||
insert into t1 select a,a from one_k;
|
||||
set optimizer_trace='enabled=on';
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
explain select * from t1 force index (a_b) where a=2 and b=4;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
explain select * from t1 where a >= 900 and b between 10 and 20;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
drop table t0,t1;
|
||||
|
||||
|
@ -418,7 +451,10 @@ create table t1 (start_date date, end_date date, filler char(100), key(start_dat
|
|||
insert into t1 select date_add(now(), interval a day), date_add(now(), interval (a+7) day), 'data' from one_k;
|
||||
--enable_warnings
|
||||
explain select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01';
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1,one_k;
|
||||
|
||||
create table ten(a int);
|
||||
|
@ -433,7 +469,10 @@ create table t1 (
|
|||
|
||||
insert into t1 select a,a, a,a from ten;
|
||||
explain select * from t1 force index(a_b_c) where a between 1 and 4 and b < 50;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table ten,t1;
|
||||
|
||||
--echo # Ported test from MYSQL for ranges involving Binary column
|
||||
|
@ -442,11 +481,14 @@ CREATE TABLE t1(i INT PRIMARY KEY, b BINARY(16), INDEX i_b(b));
|
|||
INSERT INTO t1 VALUES (1, x'D95B94336A9946A39CF5B58CFE772D8C');
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
EXPLAIN SELECT * FROM t1 WHERE b IN (0xD95B94336A9946A39CF5B58CFE772D8C);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE b IS NULL;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
@ -459,6 +501,8 @@ INSERT INTO t1 VALUES (1, 'ab\n');
|
|||
INSERT INTO t1 VALUES (2, NULL);
|
||||
set optimizer_trace=1;
|
||||
EXPLAIN SELECT * FROM t1 WHERE b='ab\n';
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
ALTER TABLE t1 modify column b BINARY(10) AFTER i;
|
||||
|
@ -502,6 +546,7 @@ insert into t1 select date_add(now(), interval a day), date_add(now(), interval
|
|||
--enable_warnings
|
||||
explain format=json select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01';
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1, t0, one_k;
|
||||
|
||||
--echo #
|
||||
|
@ -533,13 +578,19 @@ set optimizer_trace=1;
|
|||
--echo # but for joins using condition selectivity it is not as trivial. So,
|
||||
--echo # now we are printing it)
|
||||
explain select * from t0 A, one_k B where A.a<5 and B.a<800;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
set join_cache_level=@tmp_jcl;
|
||||
|
||||
--echo # This shows post-join selectivity
|
||||
explain select * from t0 A, one_k B where A.a=B.b and B.a<800;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t0, one_k;
|
||||
|
||||
--echo #
|
||||
|
@ -551,7 +602,10 @@ insert into t1 values ('foo'), ('bar');
|
|||
|
||||
EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0);
|
||||
SELECT * FROM t1 WHERE a= REPEAT('a', 0);
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
|
@ -569,7 +623,10 @@ insert into t3 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
|||
explain
|
||||
select * from t3 where (a,a) in (select t1.a, t2.a from t1, t2 where t1.b=t2.b);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
@ -581,7 +638,10 @@ create table t1 (kp1 int, kp2 int, key(kp1, kp2));
|
|||
insert into t1 values (1,1),(1,5),(5,1),(5,5);
|
||||
set optimizer_trace=1;
|
||||
select * from t1 force index(kp1) where (kp1=2 and kp2 >=4);
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
|
@ -595,7 +655,10 @@ INSERT INTO t2 SELECT seq, seq from seq_1_to_100;
|
|||
|
||||
SET OPTIMIZER_TRACE=1;
|
||||
EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
|
@ -607,12 +670,15 @@ CREATE TABLE t1(a INT, b INT);
|
|||
INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
|
||||
SET optimizer_trace=1;
|
||||
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
EXPLAIN EXTENDED SELECT * from t1 WHERE a between 1 and 5 and b <= 5;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
EXPLAIN EXTENDED SELECT * from t1 WHERE a != 5;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
|
@ -623,7 +689,10 @@ drop table t1;
|
|||
CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
|
||||
SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
|
||||
UPDATE t1 SET b=10 WHERE a=1;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
DROP TABLE t1;
|
||||
|
||||
set optimizer_trace='enabled=off';
|
||||
|
@ -684,10 +753,13 @@ where
|
|||
c5 in (1,2,3,4,5,6,7,8,9,10) and
|
||||
c6 in (1,2,3,4);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select
|
||||
json_detailed(json_extract(trace, '$**.setup_range_conditions'))
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
@ -701,7 +773,9 @@ CREATE TABLE t (a int, b int);
|
|||
CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c;
|
||||
INSERT INTO t VALUES (0,4),(5,6);
|
||||
UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a;
|
||||
--disable_view_protocol
|
||||
SELECT * FROM information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
SELECT * FROM t;
|
||||
|
||||
|
@ -794,11 +868,14 @@ set optimizer_trace=DEFAULT;
|
|||
--echo # MDEV-29179 Condition pushdown from HAVING into WHERE is not shown in optimizer trace
|
||||
--echo #
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
CREATE TABLE t1 (a INT, b VARCHAR(1), KEY (a), KEY(b,a)) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES (4,'n'),(1,'h'),(NULL,'w');
|
||||
SET optimizer_trace= 'enabled=on';
|
||||
SELECT b, a FROM t1 WHERE b <> 'p' OR a = 4 GROUP BY b, a HAVING a <= 7; SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ) exp1, JSON_VALID(trace) exp2 FROM information_schema.optimizer_trace;
|
||||
DROP TABLE t1;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
|
@ -833,8 +910,11 @@ insert into t3 select a,a from t0;
|
|||
explain
|
||||
select * from t1 left join (t2 join t3 on t3.pk=1000) on t2.a=t1.a and t2.pk is null;
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) as jd
|
||||
from information_schema.optimizer_trace;
|
||||
--disable_view_protocol
|
||||
|
||||
drop table t0, t1, t2, t3;
|
||||
|
||||
|
@ -850,17 +930,27 @@ set in_predicate_conversion_threshold=3;
|
|||
|
||||
explain select * from t0 where a in (1,2,3,4,5,6);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
explain select * from t0 where a in (1,2,3,4,5,a+1);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
explain select * from t0 where a in ('1','2','3','4','5','6');
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
set in_predicate_conversion_threshold=@tmp;
|
||||
drop table t0;
|
||||
|
@ -875,7 +965,9 @@ set optimizer_trace=1;
|
|||
|
||||
insert into t2 select * from t1 where a<= b and a>4;
|
||||
|
||||
--disable_view_protocol
|
||||
select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ from t0 A, t0 B, t0 C;
|
|||
|
||||
--echo This should use union:
|
||||
explain select * from t1 where a=1 or b=1;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t0,t1;
|
||||
set optimizer_trace="enabled=off";
|
||||
set @@optimizer_switch= @tmp_opt_switch;
|
||||
|
|
|
@ -33,7 +33,9 @@ set optimizer_trace="enabled=on";
|
|||
set @tmp_index_merge_ror_cpk=@@optimizer_switch;
|
||||
set optimizer_switch='extended_keys=off';
|
||||
explain select * from t1 where pk1 != 0 and key1 = 1;
|
||||
--disable_view_protocol
|
||||
select * from information_schema.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
set @@optimizer_switch= @tmp_index_merge_ror_cpk;
|
||||
|
||||
|
|
|
@ -6,5 +6,8 @@ insert into t1 values ('a', 'a');
|
|||
insert into t1 values ('a', 'a');
|
||||
set optimizer_trace=1;
|
||||
explain format=json select * from t1 force index(col1) where col1 >='a';
|
||||
# Enable after fix MDEV-31408
|
||||
--disable_view_protocol
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
|
|
@ -26,8 +26,11 @@ explain select * from t2 where key1 in (1,2,3) and pk not in (1,2,3);
|
|||
|
||||
--echo # This should show only ranges in form "(1) <= (key1) <= (1)"
|
||||
--echo # ranges over "pk" should not be constructed.
|
||||
# Enable after fix MDEV-31408
|
||||
--disable_view_protocol
|
||||
select json_detailed(JSON_EXTRACT(trace, '$**.ranges'))
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
set optimizer_trace=@tmp_21958;
|
||||
|
||||
drop table t2;
|
||||
|
|
|
@ -98,9 +98,12 @@ set @tmp=@@optimizer_trace;
|
|||
set optimizer_trace=1;
|
||||
explain select * from t10 where a in (91303);
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
--echo # Must have selectivity_from_histogram <= 1.0:
|
||||
select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
|
||||
from information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
set optimizer_trace=@tmp;
|
||||
drop table t0,t1,t10;
|
||||
|
@ -169,17 +172,23 @@ while ($i < $N_CONDS) {
|
|||
#echo $query_tbl;
|
||||
evalp $query_tbl;
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_columns[0]')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
|
||||
--enable_view_protocol
|
||||
|
||||
evalp $query_tbl;
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
eval select
|
||||
json_detailed(json_extract(trace,'\$**.selectivity_for_columns[$N_LAST_COND]')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # Check if not being able to infer anything for the first MAX_KEY
|
||||
|
@ -200,10 +209,13 @@ let $query_tbl= $query_tbl) and col$N_LAST_COND>1;
|
|||
#echo $query_tbl;
|
||||
evalp $query_tbl;
|
||||
|
||||
#Enable after fix MDEV-32034
|
||||
--disable_view_protocol
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_columns')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
--enable_view_protocol
|
||||
|
||||
set optimizer_trace=@trace_tmp;
|
||||
drop table t1;
|
||||
|
|
|
@ -338,7 +338,10 @@ CREATE TABLE `t1` (
|
|||
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
|
||||
#Enable after fix MDEV-31937
|
||||
--disable_ps2_protocol
|
||||
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
|
||||
--enable_ps2_protocol
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
|
@ -2998,10 +3001,13 @@ SELECT a, AVG(b),
|
|||
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
|
||||
FROM t1 WHERE t1.d=0 GROUP BY a;
|
||||
|
||||
# Enable after fix MDEV-32038
|
||||
--disable_ps2_protocol
|
||||
SELECT tt.a,
|
||||
(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
|
||||
LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
|
||||
FROM t1 as tt;
|
||||
--enable_ps2_protocol
|
||||
|
||||
SELECT tt.a,
|
||||
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
|
||||
|
|
|
@ -23,8 +23,10 @@ error 1,1030;
|
|||
create temporary table t2 (a int);
|
||||
error 1,1030;
|
||||
create temporary table t3 (a int) engine=Aria;
|
||||
--disable_view_protocol
|
||||
error 1,1030;
|
||||
select * from information_schema.columns where table_schema='test';
|
||||
--enable_view_protocol
|
||||
|
||||
flush tables;
|
||||
select * from d1;
|
||||
|
|
Loading…
Reference in a new issue