1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Counters for Index Condition Pushdown added (MDEV-130).

This commit is contained in:
unknown
2012-02-16 08:49:10 +02:00
parent 764eeeee74
commit 607aab9c1d
16 changed files with 181 additions and 6 deletions

View File

@ -852,3 +852,25 @@ SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
--echo # check "Handler_pushed" status varuiables
CREATE TABLE t1 (
c1 CHAR(1),
c2 CHAR(1),
KEY (c1)
);
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_pushed%";
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
show status like "Handler_pushed%";
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
show status like "Handler_pushed%";
DROP TABLE t1;

View File

@ -808,5 +808,32 @@ COUNT(*)
1478
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
# check "Handler_pushed" status varuiables
CREATE TABLE t1 (
c1 CHAR(1),
c2 CHAR(1),
KEY (c1)
);
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
DROP TABLE t1;
set optimizer_switch=@innodb_icp_tmp;
set storage_engine= @save_storage_engine;

View File

@ -3506,6 +3506,7 @@ insert into t2 values (2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'),
insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
(4,4, 'qwerty');
flush status;
set join_cache_level=5;
select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
@ -3519,6 +3520,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 20
Handler_pushed_index_cond_filtered 16
set join_cache_level=6;
select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
@ -3532,6 +3537,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 40
Handler_pushed_index_cond_filtered 32
set join_cache_level=7;
select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
@ -3545,6 +3554,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 60
Handler_pushed_index_cond_filtered 48
set join_cache_level=8;
select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
@ -3558,6 +3571,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 80
Handler_pushed_index_cond_filtered 64
drop table t1,t2;
set join_cache_level=default;
#

View File

@ -814,5 +814,32 @@ COUNT(*)
1478
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
# check "Handler_pushed" status varuiables
CREATE TABLE t1 (
c1 CHAR(1),
c2 CHAR(1),
KEY (c1)
);
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
DROP TABLE t1;
set storage_engine= @save_storage_engine;
set optimizer_switch=@maria_icp_tmp;

View File

@ -812,6 +812,33 @@ COUNT(*)
1478
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
# check "Handler_pushed" status varuiables
CREATE TABLE t1 (
c1 CHAR(1),
c2 CHAR(1),
KEY (c1)
);
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_pushed%";
Variable_name Value
Handler_pushed_index_cond_checks 2
Handler_pushed_index_cond_filtered 1
DROP TABLE t1;
drop table if exists t0, t1, t1i, t1m;
#
# BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed

View File

@ -276,6 +276,8 @@ Handler_commit 0
Handler_delete 0
Handler_discover 0
Handler_prepare 0
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
Handler_read_first 0
Handler_read_key 4
Handler_read_next 0
@ -297,7 +299,7 @@ Created_tmp_files 0
Created_tmp_tables 2
Handler_tmp_update 2
Handler_tmp_write 7
Rows_tmp_read 35
Rows_tmp_read 37
drop table t1;
CREATE TABLE t1 (i int(11) DEFAULT NULL, KEY i (i) ) ENGINE=MyISAM;
insert into t1 values (1),(2),(3),(4),(5);
@ -311,6 +313,8 @@ Handler_commit 0
Handler_delete 0
Handler_discover 0
Handler_prepare 0
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
Handler_read_first 0
Handler_read_key 2
Handler_read_next 2

View File

@ -101,6 +101,8 @@ Handler_commit 19
Handler_delete 1
Handler_discover 0
Handler_prepare 18
Handler_pushed_index_cond_checks 0
Handler_pushed_index_cond_filtered 0
Handler_read_first 0
Handler_read_key 3
Handler_read_next 0

View File

@ -1526,12 +1526,14 @@ insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
(4,4, 'qwerty');
flush status;
set join_cache_level=5;
select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
explain select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
show status like "Handler_pushed%";
set join_cache_level=6;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -1539,6 +1541,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
explain select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
show status like "Handler_pushed%";
set join_cache_level=7;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -1546,6 +1549,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
explain select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
show status like "Handler_pushed%";
set join_cache_level=8;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -1553,6 +1557,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
explain select t2.f1, t2.f2, t2.f3 from t1,t2
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
show status like "Handler_pushed%";
drop table t1,t2;
set join_cache_level=default;