mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.1' into 10.2
This commit is contained in:
@ -789,9 +789,9 @@ set optimizer_use_condition_selectivity=3;
|
||||
explain extended
|
||||
select * from t1 where a < 1 and a > 7;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
|
||||
select * from t1 where a < 1 and a > 7;
|
||||
a
|
||||
drop table t1;
|
||||
@ -1516,9 +1516,9 @@ col1
|
||||
explain extended
|
||||
select * from t2 where col1 < 'b' and col1 > 'd';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
|
||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd'
|
||||
drop table t1,t2;
|
||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
@ -1605,6 +1605,46 @@ drop table t1,t0;
|
||||
set histogram_size=@save_histogram_size;
|
||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
#
|
||||
# MDEV-15306: Wrong/Unexpected result with the value
|
||||
# optimizer_use_condition_selectivity set to 4
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
|
||||
BEGIN
|
||||
SET @cnt := @cnt + 1;
|
||||
RETURN 1;
|
||||
END;|
|
||||
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
|
||||
set @save_use_stat_tables= @@use_stat_tables;
|
||||
set @@use_stat_tables='complementary';
|
||||
set @@optimizer_use_condition_selectivity=4;
|
||||
SET @cnt= 0;
|
||||
SELECT * FROM t1 WHERE a = f1();
|
||||
a
|
||||
1
|
||||
SELECT @cnt;
|
||||
@cnt
|
||||
1
|
||||
set @@use_stat_tables='preferably';
|
||||
analyze table t1 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
SET @cnt := 0;
|
||||
set @@optimizer_use_condition_selectivity=4;
|
||||
SELECT * FROM t1 WHERE a = f1();
|
||||
a
|
||||
1
|
||||
SELECT @cnt;
|
||||
@cnt
|
||||
2
|
||||
alter table t1 force;
|
||||
set @@use_stat_tables= @save_use_stat_tables;
|
||||
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
||||
set @tmp_ust= @@use_stat_tables;
|
||||
set @tmp_oucs= @@optimizer_use_condition_selectivity;
|
||||
|
Reference in New Issue
Block a user