| 1 |
# Connection con1 |
| 2 |
create database explain_test_db; |
| 3 |
create table explain_test_db.explain_test_table(a int); |
| 4 |
lock table explain_test_db.explain_test_table write; |
| 5 |
insert into explain_test_db.explain_test_table values (1); |
| 6 |
# Connection default |
| 7 |
select OBJECT_INSTANCE_BEGIN, OWNER_THREAD_ID, OWNER_EVENT_ID |
| 8 |
from performance_schema.table_handles |
| 9 |
where OBJECT_NAME = 'explain_test_table' |
| 10 |
into @oib, @o_tid, @o_eid; |
| 11 |
|
| 12 |
==================================================================== |
| 13 |
Testing index for columns OBJECT_INSTANCE_BEGIN |
| 14 |
==================================================================== |
| 15 |
############ Explain for Query #################################### |
| 16 |
explain select COUNT(*) |
| 17 |
from performance_schema.table_handles |
| 18 |
where OBJECT_INSTANCE_BEGIN = "impossible"; |
| 19 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 20 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 21 |
############ Explain for Query #################################### |
| 22 |
explain select COUNT(*) |
| 23 |
from performance_schema.table_handles |
| 24 |
where OBJECT_INSTANCE_BEGIN > "impossible"; |
| 25 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 26 |
1 SIMPLE table_handles NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 27 |
############ Explain for Query #################################### |
| 28 |
explain select COUNT(*) |
| 29 |
from performance_schema.table_handles |
| 30 |
where OBJECT_INSTANCE_BEGIN < "2"; |
| 31 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 32 |
1 SIMPLE table_handles NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 33 |
############ Explain for Query #################################### |
| 34 |
explain select COUNT(*) |
| 35 |
from performance_schema.table_handles |
| 36 |
where OBJECT_INSTANCE_BEGIN = @oib; |
| 37 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 38 |
1 SIMPLE table_handles NULL const PRIMARY PRIMARY 8 const # 100.00 NULL |
| 39 |
############# Explain End ######################################### |
| 40 |
flush status; |
| 41 |
select COUNT(*) |
| 42 |
from performance_schema.table_handles |
| 43 |
where OBJECT_INSTANCE_BEGIN = @oib; |
| 44 |
COUNT(*) |
| 45 |
# |
| 46 |
OK: handler_read_key incremented |
| 47 |
|
| 48 |
==================================================================== |
| 49 |
Testing index for columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME |
| 50 |
==================================================================== |
| 51 |
############ Explain for Query #################################### |
| 52 |
explain select COUNT(*) |
| 53 |
from performance_schema.table_handles |
| 54 |
where OBJECT_TYPE = "impossible"; |
| 55 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 56 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 258 const # 100.00 NULL |
| 57 |
############ Explain for Query #################################### |
| 58 |
explain select COUNT(*) |
| 59 |
from performance_schema.table_handles |
| 60 |
where OBJECT_TYPE > "impossible"; |
| 61 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 62 |
1 SIMPLE table_handles NULL ALL OBJECT_TYPE NULL NULL NULL # 33.33 Using where |
| 63 |
############ Explain for Query #################################### |
| 64 |
explain select COUNT(*) |
| 65 |
from performance_schema.table_handles |
| 66 |
where OBJECT_TYPE < "2"; |
| 67 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 68 |
1 SIMPLE table_handles NULL ALL OBJECT_TYPE NULL NULL NULL # 33.33 Using where |
| 69 |
############ Explain for Query #################################### |
| 70 |
explain select COUNT(*) |
| 71 |
from performance_schema.table_handles |
| 72 |
where OBJECT_TYPE = "TABLE"; |
| 73 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 74 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 258 const # 100.00 NULL |
| 75 |
############ Explain for Query #################################### |
| 76 |
explain select COUNT(*) |
| 77 |
from performance_schema.table_handles |
| 78 |
where OBJECT_TYPE = "impossible" |
| 79 |
and OBJECT_SCHEMA = "impossible"; |
| 80 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 81 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 516 const,const # 100.00 NULL |
| 82 |
############ Explain for Query #################################### |
| 83 |
explain select COUNT(*) |
| 84 |
from performance_schema.table_handles |
| 85 |
where OBJECT_TYPE = "TABLE" |
| 86 |
and OBJECT_SCHEMA = "impossible"; |
| 87 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 88 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 516 const,const # 100.00 NULL |
| 89 |
############ Explain for Query #################################### |
| 90 |
explain select COUNT(*) |
| 91 |
from performance_schema.table_handles |
| 92 |
where OBJECT_TYPE = "TABLE" |
| 93 |
and OBJECT_SCHEMA > "impossible"; |
| 94 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 95 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 258 const # 33.33 Using where |
| 96 |
############ Explain for Query #################################### |
| 97 |
explain select COUNT(*) |
| 98 |
from performance_schema.table_handles |
| 99 |
where OBJECT_TYPE = "TABLE" |
| 100 |
and OBJECT_SCHEMA < "2"; |
| 101 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 102 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 258 const # 33.33 Using where |
| 103 |
############ Explain for Query #################################### |
| 104 |
explain select COUNT(*) |
| 105 |
from performance_schema.table_handles |
| 106 |
where OBJECT_TYPE = "TABLE" |
| 107 |
and OBJECT_SCHEMA = "explain_test_db"; |
| 108 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 109 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 516 const,const # 100.00 NULL |
| 110 |
############ Explain for Query #################################### |
| 111 |
explain select COUNT(*) |
| 112 |
from performance_schema.table_handles |
| 113 |
where OBJECT_TYPE = "impossible" |
| 114 |
and OBJECT_SCHEMA = "impossible" |
| 115 |
and OBJECT_NAME = "impossible"; |
| 116 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 117 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 774 const,const,const # 100.00 NULL |
| 118 |
############ Explain for Query #################################### |
| 119 |
explain select COUNT(*) |
| 120 |
from performance_schema.table_handles |
| 121 |
where OBJECT_TYPE = "TABLE" |
| 122 |
and OBJECT_SCHEMA = "explain_test_db" |
| 123 |
and OBJECT_NAME = "impossible"; |
| 124 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 125 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 774 const,const,const # 100.00 NULL |
| 126 |
############ Explain for Query #################################### |
| 127 |
explain select COUNT(*) |
| 128 |
from performance_schema.table_handles |
| 129 |
where OBJECT_TYPE = "TABLE" |
| 130 |
and OBJECT_SCHEMA = "explain_test_db" |
| 131 |
and OBJECT_NAME > "impossible"; |
| 132 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 133 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 516 const,const # 33.33 Using where |
| 134 |
############ Explain for Query #################################### |
| 135 |
explain select COUNT(*) |
| 136 |
from performance_schema.table_handles |
| 137 |
where OBJECT_TYPE = "TABLE" |
| 138 |
and OBJECT_SCHEMA = "explain_test_db" |
| 139 |
and OBJECT_NAME < "2"; |
| 140 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 141 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 516 const,const # 33.33 Using where |
| 142 |
############ Explain for Query #################################### |
| 143 |
explain select COUNT(*) |
| 144 |
from performance_schema.table_handles |
| 145 |
where OBJECT_TYPE = "TABLE" |
| 146 |
and OBJECT_SCHEMA = "explain_test_db" |
| 147 |
and OBJECT_NAME = "explain_test_table"; |
| 148 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 149 |
1 SIMPLE table_handles NULL ref OBJECT_TYPE OBJECT_TYPE 774 const,const,const # 100.00 NULL |
| 150 |
############# Explain End ######################################### |
| 151 |
flush status; |
| 152 |
select COUNT(*) |
| 153 |
from performance_schema.table_handles |
| 154 |
where OBJECT_TYPE = "TABLE" |
| 155 |
and OBJECT_SCHEMA = "explain_test_db" |
| 156 |
and OBJECT_NAME = "explain_test_table"; |
| 157 |
COUNT(*) |
| 158 |
# |
| 159 |
OK: handler_read_key incremented |
| 160 |
|
| 161 |
==================================================================== |
| 162 |
Testing index for columns OWNER_THREAD_ID, OWNER_EVENT_ID |
| 163 |
==================================================================== |
| 164 |
############ Explain for Query #################################### |
| 165 |
explain select COUNT(*) |
| 166 |
from performance_schema.table_handles |
| 167 |
where OWNER_THREAD_ID = "impossible"; |
| 168 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 169 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 9 const # 100.00 Using where |
| 170 |
############ Explain for Query #################################### |
| 171 |
explain select COUNT(*) |
| 172 |
from performance_schema.table_handles |
| 173 |
where OWNER_THREAD_ID > "impossible"; |
| 174 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 175 |
1 SIMPLE table_handles NULL ALL OWNER_THREAD_ID NULL NULL NULL # 33.33 Using where |
| 176 |
############ Explain for Query #################################### |
| 177 |
explain select COUNT(*) |
| 178 |
from performance_schema.table_handles |
| 179 |
where OWNER_THREAD_ID < "2"; |
| 180 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 181 |
1 SIMPLE table_handles NULL ALL OWNER_THREAD_ID NULL NULL NULL # 33.33 Using where |
| 182 |
############ Explain for Query #################################### |
| 183 |
explain select COUNT(*) |
| 184 |
from performance_schema.table_handles |
| 185 |
where OWNER_THREAD_ID = @o_tid; |
| 186 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 187 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 9 const # 100.00 NULL |
| 188 |
############ Explain for Query #################################### |
| 189 |
explain select COUNT(*) |
| 190 |
from performance_schema.table_handles |
| 191 |
where OWNER_THREAD_ID = "impossible" |
| 192 |
and OWNER_EVENT_ID = "impossible"; |
| 193 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 194 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 18 const,const # 100.00 Using where |
| 195 |
############ Explain for Query #################################### |
| 196 |
explain select COUNT(*) |
| 197 |
from performance_schema.table_handles |
| 198 |
where OWNER_THREAD_ID = @o_tid |
| 199 |
and OWNER_EVENT_ID = "impossible"; |
| 200 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 201 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 18 const,const # 100.00 Using where |
| 202 |
############ Explain for Query #################################### |
| 203 |
explain select COUNT(*) |
| 204 |
from performance_schema.table_handles |
| 205 |
where OWNER_THREAD_ID = @o_tid |
| 206 |
and OWNER_EVENT_ID > "impossible"; |
| 207 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 208 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 9 const # 33.33 Using where |
| 209 |
############ Explain for Query #################################### |
| 210 |
explain select COUNT(*) |
| 211 |
from performance_schema.table_handles |
| 212 |
where OWNER_THREAD_ID = @o_tid |
| 213 |
and OWNER_EVENT_ID < "2"; |
| 214 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 215 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 9 const # 33.33 Using where |
| 216 |
############ Explain for Query #################################### |
| 217 |
explain select COUNT(*) |
| 218 |
from performance_schema.table_handles |
| 219 |
where OWNER_THREAD_ID = @o_tid |
| 220 |
and OWNER_EVENT_ID = @o_eid; |
| 221 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 222 |
1 SIMPLE table_handles NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 18 const,const # 100.00 NULL |
| 223 |
############# Explain End ######################################### |
| 224 |
flush status; |
| 225 |
select COUNT(*) |
| 226 |
from performance_schema.table_handles |
| 227 |
where OWNER_THREAD_ID = @o_tid |
| 228 |
and OWNER_EVENT_ID = @o_eid; |
| 229 |
COUNT(*) |
| 230 |
# |
| 231 |
OK: handler_read_key incremented |
| 232 |
# Connection con1 |
| 233 |
unlock tables; |
| 234 |
drop table explain_test_db.explain_test_table; |
| 235 |
drop database explain_test_db; |
| 236 |
# Connection default |