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