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