85 lines
3.8 KiB
Plaintext
85 lines
3.8 KiB
Plaintext
create database explain_test_db;
|
|
create table explain_test_db.t1 (c int);
|
|
insert into explain_test_db.t1 values ('1');
|
|
truncate table performance_schema.events_waits_history;
|
|
# Connection 1
|
|
select connection_id() into @conid;
|
|
select * from explain_test_db.t1;
|
|
c
|
|
1
|
|
# Default connection
|
|
|
|
====================================================================
|
|
Testing index for columns THREAD_ID, EVENT_ID
|
|
====================================================================
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = "impossible";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 100.00 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID > "impossible";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID < "2";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid;
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 100.00 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = "impossible"
|
|
and EVENT_ID = "impossible";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid
|
|
and EVENT_ID = "impossible";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid
|
|
and EVENT_ID > "impossible";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 33.33 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid
|
|
and EVENT_ID < "2";
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL ref PRIMARY PRIMARY 8 const # 33.33 Using where
|
|
############ Explain for Query ####################################
|
|
explain select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid
|
|
and EVENT_ID = @eid;
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE events_waits_history NULL const PRIMARY PRIMARY 16 const,const # 100.00 NULL
|
|
############# Explain End #########################################
|
|
flush status;
|
|
select END_EVENT_ID
|
|
from performance_schema.events_waits_history
|
|
where THREAD_ID = @tid
|
|
and EVENT_ID = @eid;
|
|
END_EVENT_ID
|
|
#
|
|
OK: handler_read_key incremented
|
|
drop table explain_test_db.t1;
|
|
drop database explain_test_db;
|