mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16188 Post review fixes
Also adjusted some test files.
This commit is contained in:
@ -226,6 +226,7 @@ EXPLAIN
|
|||||||
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
|
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
|
||||||
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
|
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
|
||||||
|
|
||||||
|
--replace_column 9 100
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;
|
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;
|
||||||
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;
|
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;
|
||||||
|
@ -479,6 +479,7 @@ create table t2(
|
|||||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
|
|
||||||
|
|
||||||
--echo must use sort-union rather than union:
|
--echo must use sort-union rather than union:
|
||||||
--replace_column 9 #
|
--replace_column 9 #
|
||||||
explain select * from t1 where a=4 or b=4;
|
explain select * from t1 where a=4 or b=4;
|
||||||
@ -489,9 +490,9 @@ select * from t1 ignore index(a,b) where a=4 or b=4;
|
|||||||
|
|
||||||
--echo must use union, not sort-union:
|
--echo must use union, not sort-union:
|
||||||
--replace_column 9 #
|
--replace_column 9 #
|
||||||
explain select * from t2 where a=4 or b=4;
|
explain select * from t2 where a=2 or b=2;
|
||||||
--sorted_result
|
--sorted_result
|
||||||
select * from t2 where a=4 or b=4;
|
select * from t2 where a=2 or b=2;
|
||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
@ -522,18 +522,13 @@ a filler b
|
|||||||
4 zz 4
|
4 zz 4
|
||||||
5 qq 4
|
5 qq 4
|
||||||
must use union, not sort-union:
|
must use union, not sort-union:
|
||||||
explain select * from t2 where a=4 or b=4;
|
explain select * from t2 where a=2 or b=2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ALL a,b NULL NULL NULL # Using where
|
1 SIMPLE t2 index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where
|
||||||
select * from t2 where a=4 or b=4;
|
select * from t2 where a=2 or b=2;
|
||||||
a filler b
|
a filler b
|
||||||
4 4 0
|
2 filler 2
|
||||||
4 5 0
|
2 filler 2
|
||||||
4 filler 4
|
|
||||||
4 filler 4
|
|
||||||
4 qq 5
|
|
||||||
4 zz 4
|
|
||||||
5 qq 4
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
|
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
|
||||||
KEY b(b), KEY a(a));
|
KEY b(b), KEY a(a));
|
||||||
|
@ -824,8 +824,8 @@ set optimizer_switch='extended_keys=off';
|
|||||||
explain
|
explain
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
|
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
||||||
1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
|
1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where
|
||||||
flush status;
|
flush status;
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
a pk a b
|
a pk a b
|
||||||
@ -846,8 +846,8 @@ set optimizer_switch='extended_keys=on';
|
|||||||
explain
|
explain
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
|
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
||||||
1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
|
1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where
|
||||||
flush status;
|
flush status;
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
a pk a b
|
a pk a b
|
||||||
|
@ -497,6 +497,7 @@ select
|
|||||||
from t1 A, t1 B;
|
from t1 A, t1 B;
|
||||||
|
|
||||||
set optimizer_switch='extended_keys=off';
|
set optimizer_switch='extended_keys=off';
|
||||||
|
--replace_column 9 #
|
||||||
explain
|
explain
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
flush status;
|
flush status;
|
||||||
@ -504,6 +505,7 @@ select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
|||||||
show status like 'handler_read%';
|
show status like 'handler_read%';
|
||||||
|
|
||||||
set optimizer_switch='extended_keys=on';
|
set optimizer_switch='extended_keys=on';
|
||||||
|
--replace_column 9 #
|
||||||
explain
|
explain
|
||||||
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
|
||||||
flush status;
|
flush status;
|
||||||
|
@ -815,10 +815,10 @@ explain
|
|||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
|
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
|
||||||
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
|
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
|
||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
f12
|
f12
|
||||||
|
@ -995,6 +995,8 @@ CREATE TABLE t3 (f12 varchar(1) NOT NULL) ENGINE=InnoDB;
|
|||||||
INSERT INTO t3 VALUES ('r'),('s'),('t'),('v'),('w'),('x'),('y');
|
INSERT INTO t3 VALUES ('r'),('s'),('t'),('v'),('w'),('x'),('y');
|
||||||
|
|
||||||
--echo # The following must use LooseScan but not join buffering
|
--echo # The following must use LooseScan but not join buffering
|
||||||
|
|
||||||
|
--replace_column 9 #
|
||||||
explain
|
explain
|
||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
|
@ -831,10 +831,10 @@ explain
|
|||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
|
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
|
||||||
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
|
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
|
||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
f12
|
f12
|
||||||
|
@ -817,10 +817,10 @@ explain
|
|||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
|
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
|
||||||
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
|
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
|
||||||
SELECT * FROM t3
|
SELECT * FROM t3
|
||||||
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
|
||||||
f12
|
f12
|
||||||
|
@ -189,8 +189,6 @@ int compare_range_rowid_filter_cost_info_by_a(
|
|||||||
|
|
||||||
void TABLE::prune_range_rowid_filters()
|
void TABLE::prune_range_rowid_filters()
|
||||||
{
|
{
|
||||||
uint i, j;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For the elements of the array with cost info on range filters
|
For the elements of the array with cost info on range filters
|
||||||
build a bit matrix of absolutely independent elements.
|
build a bit matrix of absolutely independent elements.
|
||||||
@ -201,11 +199,15 @@ void TABLE::prune_range_rowid_filters()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Range_rowid_filter_cost_info **filter_ptr_1= range_rowid_filter_cost_info_ptr;
|
Range_rowid_filter_cost_info **filter_ptr_1= range_rowid_filter_cost_info_ptr;
|
||||||
for (i= 0; i < range_rowid_filter_cost_info_elems; i++, filter_ptr_1++)
|
for (uint i= 0;
|
||||||
|
i < range_rowid_filter_cost_info_elems;
|
||||||
|
i++, filter_ptr_1++)
|
||||||
{
|
{
|
||||||
uint key_no= (*filter_ptr_1)->key_no;
|
uint key_no= (*filter_ptr_1)->key_no;
|
||||||
Range_rowid_filter_cost_info **filter_ptr_2= filter_ptr_1 + 1;
|
Range_rowid_filter_cost_info **filter_ptr_2= filter_ptr_1 + 1;
|
||||||
for (j= i+1; j < range_rowid_filter_cost_info_elems; j++, filter_ptr_2++)
|
for (uint j= i+1;
|
||||||
|
j < range_rowid_filter_cost_info_elems;
|
||||||
|
j++, filter_ptr_2++)
|
||||||
{
|
{
|
||||||
key_map map_1= key_info[key_no].overlapped;
|
key_map map_1= key_info[key_no].overlapped;
|
||||||
map_1.merge(key_info[key_no].constraint_correlated);
|
map_1.merge(key_info[key_no].constraint_correlated);
|
||||||
@ -236,7 +238,9 @@ void TABLE::prune_range_rowid_filters()
|
|||||||
|
|
||||||
Range_rowid_filter_cost_info **cand_filter_ptr=
|
Range_rowid_filter_cost_info **cand_filter_ptr=
|
||||||
range_rowid_filter_cost_info_ptr;
|
range_rowid_filter_cost_info_ptr;
|
||||||
for (i= 0; i < range_rowid_filter_cost_info_elems; i++, cand_filter_ptr++)
|
for (uint i= 0;
|
||||||
|
i < range_rowid_filter_cost_info_elems;
|
||||||
|
i++, cand_filter_ptr++)
|
||||||
{
|
{
|
||||||
bool is_pruned= false;
|
bool is_pruned= false;
|
||||||
Range_rowid_filter_cost_info **usable_filter_ptr=
|
Range_rowid_filter_cost_info **usable_filter_ptr=
|
||||||
|
@ -153,7 +153,7 @@ class Range_rowid_filter_cost_info;
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SORTED_ARRAY_CONTAINER,
|
SORTED_ARRAY_CONTAINER,
|
||||||
BLOOM_FILTER_CONTAINER
|
BLOOM_FILTER_CONTAINER // Not used yet
|
||||||
} Rowid_filter_container_type;
|
} Rowid_filter_container_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user