| 1 |
create database explain_test_db; |
| 2 |
use explain_test_db; |
| 3 |
truncate table performance_schema.events_statements_summary_by_digest; |
| 4 |
select 1; |
| 5 |
1 |
| 6 |
1 |
| 7 |
select digest from performance_schema.events_statements_histogram_by_digest |
| 8 |
where SCHEMA_NAME = 'explain_test_db' limit 1 |
| 9 |
into @digest; |
| 10 |
use test; |
| 11 |
|
| 12 |
==================================================================== |
| 13 |
Testing index for columns SCHEMA_NAME, DIGEST, BUCKET_NUMBER |
| 14 |
==================================================================== |
| 15 |
############ Explain for Query #################################### |
| 16 |
explain select COUNT_BUCKET |
| 17 |
from performance_schema.events_statements_histogram_by_digest |
| 18 |
where SCHEMA_NAME = "impossible"; |
| 19 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 20 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 259 const # 100.00 NULL |
| 21 |
############ Explain for Query #################################### |
| 22 |
explain select COUNT_BUCKET |
| 23 |
from performance_schema.events_statements_histogram_by_digest |
| 24 |
where SCHEMA_NAME > "impossible"; |
| 25 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 26 |
1 SIMPLE events_statements_histogram_by_digest NULL ALL SCHEMA_NAME NULL NULL NULL # 33.33 Using where |
| 27 |
############ Explain for Query #################################### |
| 28 |
explain select COUNT_BUCKET |
| 29 |
from performance_schema.events_statements_histogram_by_digest |
| 30 |
where SCHEMA_NAME < "2"; |
| 31 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 32 |
1 SIMPLE events_statements_histogram_by_digest NULL ALL SCHEMA_NAME NULL NULL NULL # 33.33 Using where |
| 33 |
############ Explain for Query #################################### |
| 34 |
explain select COUNT_BUCKET |
| 35 |
from performance_schema.events_statements_histogram_by_digest |
| 36 |
where SCHEMA_NAME = "explain_test_db"; |
| 37 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 38 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 259 const # 100.00 NULL |
| 39 |
############ Explain for Query #################################### |
| 40 |
explain select COUNT_BUCKET |
| 41 |
from performance_schema.events_statements_histogram_by_digest |
| 42 |
where SCHEMA_NAME = "impossible" |
| 43 |
and DIGEST = "impossible"; |
| 44 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 45 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 518 const,const # 100.00 NULL |
| 46 |
############ Explain for Query #################################### |
| 47 |
explain select COUNT_BUCKET |
| 48 |
from performance_schema.events_statements_histogram_by_digest |
| 49 |
where SCHEMA_NAME = "explain_test_db" |
| 50 |
and DIGEST = "impossible"; |
| 51 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 52 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 518 const,const # 100.00 NULL |
| 53 |
############ Explain for Query #################################### |
| 54 |
explain select COUNT_BUCKET |
| 55 |
from performance_schema.events_statements_histogram_by_digest |
| 56 |
where SCHEMA_NAME = "explain_test_db" |
| 57 |
and DIGEST > "impossible"; |
| 58 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 59 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 259 const # 33.33 Using where |
| 60 |
############ Explain for Query #################################### |
| 61 |
explain select COUNT_BUCKET |
| 62 |
from performance_schema.events_statements_histogram_by_digest |
| 63 |
where SCHEMA_NAME = "explain_test_db" |
| 64 |
and DIGEST < "2"; |
| 65 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 66 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 259 const # 33.33 Using where |
| 67 |
############ Explain for Query #################################### |
| 68 |
explain select COUNT_BUCKET |
| 69 |
from performance_schema.events_statements_histogram_by_digest |
| 70 |
where SCHEMA_NAME = "explain_test_db" |
| 71 |
and DIGEST = @digest; |
| 72 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 73 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 518 const,const # 100.00 NULL |
| 74 |
############ Explain for Query #################################### |
| 75 |
explain select COUNT_BUCKET |
| 76 |
from performance_schema.events_statements_histogram_by_digest |
| 77 |
where SCHEMA_NAME = "impossible" |
| 78 |
and DIGEST = "impossible" |
| 79 |
and BUCKET_NUMBER = "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_BUCKET |
| 84 |
from performance_schema.events_statements_histogram_by_digest |
| 85 |
where SCHEMA_NAME = "explain_test_db" |
| 86 |
and DIGEST = @digest |
| 87 |
and BUCKET_NUMBER = "impossible"; |
| 88 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 89 |
1 SIMPLE events_statements_histogram_by_digest NULL const SCHEMA_NAME SCHEMA_NAME 522 const,const,const # 100.00 NULL |
| 90 |
############ Explain for Query #################################### |
| 91 |
explain select COUNT_BUCKET |
| 92 |
from performance_schema.events_statements_histogram_by_digest |
| 93 |
where SCHEMA_NAME = "explain_test_db" |
| 94 |
and DIGEST = @digest |
| 95 |
and BUCKET_NUMBER > "impossible"; |
| 96 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 97 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 518 const,const # 33.33 Using where |
| 98 |
############ Explain for Query #################################### |
| 99 |
explain select COUNT_BUCKET |
| 100 |
from performance_schema.events_statements_histogram_by_digest |
| 101 |
where SCHEMA_NAME = "explain_test_db" |
| 102 |
and DIGEST = @digest |
| 103 |
and BUCKET_NUMBER < "2"; |
| 104 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 105 |
1 SIMPLE events_statements_histogram_by_digest NULL ref SCHEMA_NAME SCHEMA_NAME 518 const,const # 33.33 Using where |
| 106 |
############ Explain for Query #################################### |
| 107 |
explain select COUNT_BUCKET |
| 108 |
from performance_schema.events_statements_histogram_by_digest |
| 109 |
where SCHEMA_NAME = "explain_test_db" |
| 110 |
and DIGEST = @digest |
| 111 |
and BUCKET_NUMBER = 0; |
| 112 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 113 |
1 SIMPLE events_statements_histogram_by_digest NULL const SCHEMA_NAME SCHEMA_NAME 522 const,const,const # 100.00 NULL |
| 114 |
############# Explain End ######################################### |
| 115 |
flush status; |
| 116 |
select COUNT_BUCKET |
| 117 |
from performance_schema.events_statements_histogram_by_digest |
| 118 |
where SCHEMA_NAME = "explain_test_db" |
| 119 |
and DIGEST = @digest |
| 120 |
and BUCKET_NUMBER = 0; |
| 121 |
COUNT_BUCKET |
| 122 |
# |
| 123 |
OK: handler_read_key incremented |
| 124 |
drop database explain_test_db; |