| 1 |
create database explain_test_db; |
| 2 |
create table explain_test_db.t1 (c int); |
| 3 |
insert into explain_test_db.t1 values ('1'); |
| 4 |
truncate table performance_schema.events_waits_history; |
| 5 |
# Connection 1 |
| 6 |
select connection_id() into @conid; |
| 7 |
select * from explain_test_db.t1; |
| 8 |
c |
| 9 |
1 |
| 10 |
# Default connection |
| 11 |
|
| 12 |
==================================================================== |
| 13 |
Testing index for columns THREAD_ID, EVENT_ID |
| 14 |
==================================================================== |
| 15 |
############ Explain for Query #################################### |
| 16 |
explain select END_EVENT_ID |
| 17 |
from performance_schema.events_waits_history |
| 18 |
where THREAD_ID = "impossible"; |
| 19 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 20 |
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 100.00 Using where |
| 21 |
############ Explain for Query #################################### |
| 22 |
explain select END_EVENT_ID |
| 23 |
from performance_schema.events_waits_history |
| 24 |
where THREAD_ID > "impossible"; |
| 25 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 26 |
1 SIMPLE events_waits_history NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 27 |
############ Explain for Query #################################### |
| 28 |
explain select END_EVENT_ID |
| 29 |
from performance_schema.events_waits_history |
| 30 |
where THREAD_ID < "2"; |
| 31 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 32 |
1 SIMPLE events_waits_history NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 33 |
############ Explain for Query #################################### |
| 34 |
explain select END_EVENT_ID |
| 35 |
from performance_schema.events_waits_history |
| 36 |
where THREAD_ID = @tid; |
| 37 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 38 |
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 100.00 NULL |
| 39 |
############ Explain for Query #################################### |
| 40 |
explain select END_EVENT_ID |
| 41 |
from performance_schema.events_waits_history |
| 42 |
where THREAD_ID = "impossible" |
| 43 |
and EVENT_ID = "impossible"; |
| 44 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 45 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 46 |
############ Explain for Query #################################### |
| 47 |
explain select END_EVENT_ID |
| 48 |
from performance_schema.events_waits_history |
| 49 |
where THREAD_ID = @tid |
| 50 |
and EVENT_ID = "impossible"; |
| 51 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 52 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 53 |
############ Explain for Query #################################### |
| 54 |
explain select END_EVENT_ID |
| 55 |
from performance_schema.events_waits_history |
| 56 |
where THREAD_ID = @tid |
| 57 |
and EVENT_ID > "impossible"; |
| 58 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 59 |
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 33.33 Using where |
| 60 |
############ Explain for Query #################################### |
| 61 |
explain select END_EVENT_ID |
| 62 |
from performance_schema.events_waits_history |
| 63 |
where THREAD_ID = @tid |
| 64 |
and EVENT_ID < "2"; |
| 65 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 66 |
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 33.33 Using where |
| 67 |
############ Explain for Query #################################### |
| 68 |
explain select END_EVENT_ID |
| 69 |
from performance_schema.events_waits_history |
| 70 |
where THREAD_ID = @tid |
| 71 |
and EVENT_ID = @eid; |
| 72 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 73 |
1 SIMPLE events_waits_history NULL const PRIMARY PRIMARY 16 const,const # 100.00 NULL |
| 74 |
############# Explain End ######################################### |
| 75 |
flush status; |
| 76 |
select END_EVENT_ID |
| 77 |
from performance_schema.events_waits_history |
| 78 |
where THREAD_ID = @tid |
| 79 |
and EVENT_ID = @eid; |
| 80 |
END_EVENT_ID |
| 81 |
# |
| 82 |
OK: handler_read_key incremented |
| 83 |
drop table explain_test_db.t1; |
| 84 |
drop database explain_test_db; |