| 1 |
create database explain_test_db; |
| 2 |
use explain_test_db; |
| 3 |
create table explain_test_table(c int); |
| 4 |
create procedure explain_test_proc() |
| 5 |
BEGIN |
| 6 |
select * from explain_test_table; |
| 7 |
END // |
| 8 |
truncate table performance_schema.events_statements_summary_by_program; |
| 9 |
call explain_test_proc(); |
| 10 |
c |
| 11 |
|
| 12 |
==================================================================== |
| 13 |
Testing index for columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME |
| 14 |
==================================================================== |
| 15 |
############ Explain for Query #################################### |
| 16 |
explain select COUNT_STAR |
| 17 |
from performance_schema.events_statements_summary_by_program |
| 18 |
where OBJECT_TYPE = "impossible"; |
| 19 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 20 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 1 const # 100.00 Using where |
| 21 |
############ Explain for Query #################################### |
| 22 |
explain select COUNT_STAR |
| 23 |
from performance_schema.events_statements_summary_by_program |
| 24 |
where OBJECT_TYPE > "impossible"; |
| 25 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 26 |
1 SIMPLE events_statements_summary_by_program NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 27 |
############ Explain for Query #################################### |
| 28 |
explain select COUNT_STAR |
| 29 |
from performance_schema.events_statements_summary_by_program |
| 30 |
where OBJECT_TYPE < "2"; |
| 31 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 32 |
1 SIMPLE events_statements_summary_by_program NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 33 |
############ Explain for Query #################################### |
| 34 |
explain select COUNT_STAR |
| 35 |
from performance_schema.events_statements_summary_by_program |
| 36 |
where OBJECT_TYPE = "PROCEDURE"; |
| 37 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 38 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 1 const # 100.00 Using where |
| 39 |
############ Explain for Query #################################### |
| 40 |
explain select COUNT_STAR |
| 41 |
from performance_schema.events_statements_summary_by_program |
| 42 |
where OBJECT_TYPE = "impossible" |
| 43 |
and OBJECT_SCHEMA = "impossible"; |
| 44 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 45 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 259 const,const # 100.00 Using where |
| 46 |
############ Explain for Query #################################### |
| 47 |
explain select COUNT_STAR |
| 48 |
from performance_schema.events_statements_summary_by_program |
| 49 |
where OBJECT_TYPE = "PROCEDURE" |
| 50 |
and OBJECT_SCHEMA = "impossible"; |
| 51 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 52 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 259 const,const # 100.00 Using where |
| 53 |
############ Explain for Query #################################### |
| 54 |
explain select COUNT_STAR |
| 55 |
from performance_schema.events_statements_summary_by_program |
| 56 |
where OBJECT_TYPE = "PROCEDURE" |
| 57 |
and OBJECT_SCHEMA > "impossible"; |
| 58 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 59 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 1 const # 33.33 Using where |
| 60 |
############ Explain for Query #################################### |
| 61 |
explain select COUNT_STAR |
| 62 |
from performance_schema.events_statements_summary_by_program |
| 63 |
where OBJECT_TYPE = "PROCEDURE" |
| 64 |
and OBJECT_SCHEMA < "2"; |
| 65 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 66 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 1 const # 33.33 Using where |
| 67 |
############ Explain for Query #################################### |
| 68 |
explain select COUNT_STAR |
| 69 |
from performance_schema.events_statements_summary_by_program |
| 70 |
where OBJECT_TYPE = "PROCEDURE" |
| 71 |
and OBJECT_SCHEMA = "explain_test_db"; |
| 72 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 73 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 259 const,const # 100.00 Using where |
| 74 |
############ Explain for Query #################################### |
| 75 |
explain select COUNT_STAR |
| 76 |
from performance_schema.events_statements_summary_by_program |
| 77 |
where OBJECT_TYPE = "impossible" |
| 78 |
and OBJECT_SCHEMA = "impossible" |
| 79 |
and OBJECT_NAME = "impossible"; |
| 80 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 81 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 82 |
############ Explain for Query #################################### |
| 83 |
explain select COUNT_STAR |
| 84 |
from performance_schema.events_statements_summary_by_program |
| 85 |
where OBJECT_TYPE = "PROCEDURE" |
| 86 |
and OBJECT_SCHEMA = "explain_test_db" |
| 87 |
and OBJECT_NAME = "impossible"; |
| 88 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 89 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 90 |
############ Explain for Query #################################### |
| 91 |
explain select COUNT_STAR |
| 92 |
from performance_schema.events_statements_summary_by_program |
| 93 |
where OBJECT_TYPE = "PROCEDURE" |
| 94 |
and OBJECT_SCHEMA = "explain_test_db" |
| 95 |
and OBJECT_NAME > "impossible"; |
| 96 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 97 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 259 const,const # 33.33 Using where |
| 98 |
############ Explain for Query #################################### |
| 99 |
explain select COUNT_STAR |
| 100 |
from performance_schema.events_statements_summary_by_program |
| 101 |
where OBJECT_TYPE = "PROCEDURE" |
| 102 |
and OBJECT_SCHEMA = "explain_test_db" |
| 103 |
and OBJECT_NAME < "2"; |
| 104 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 105 |
1 SIMPLE events_statements_summary_by_program NULL ref PRIMARY PRIMARY 259 const,const # 33.33 Using where |
| 106 |
############ Explain for Query #################################### |
| 107 |
explain select COUNT_STAR |
| 108 |
from performance_schema.events_statements_summary_by_program |
| 109 |
where OBJECT_TYPE = "PROCEDURE" |
| 110 |
and OBJECT_SCHEMA = "explain_test_db" |
| 111 |
and OBJECT_NAME = "explain_test_proc"; |
| 112 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 113 |
1 SIMPLE events_statements_summary_by_program NULL const PRIMARY PRIMARY 517 const,const,const # 100.00 NULL |
| 114 |
############# Explain End ######################################### |
| 115 |
flush status; |
| 116 |
select COUNT_STAR |
| 117 |
from performance_schema.events_statements_summary_by_program |
| 118 |
where OBJECT_TYPE = "PROCEDURE" |
| 119 |
and OBJECT_SCHEMA = "explain_test_db" |
| 120 |
and OBJECT_NAME = "explain_test_proc"; |
| 121 |
COUNT_STAR |
| 122 |
# |
| 123 |
OK: handler_read_key incremented |
| 124 |
drop procedure explain_test_proc; |
| 125 |
drop table explain_test_db.explain_test_table; |
| 126 |
drop database explain_test_db; |