1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
|
select connection_id() into @conid;
select thread_id from performance_schema.threads
where PROCESSLIST_ID = @conid
into @tid;
select thread_os_id from performance_schema.threads
where PROCESSLIST_ID = @conid
into @osid;
explain select THREAD_ID, NAME from performance_schema.threads
where thread_id = 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL const PRIMARY PRIMARY 8 const 1 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select '1' AS `THREAD_ID`,'thread/sql/main' AS `NAME` from `performance_schema`.`threads` where true
explain select * from performance_schema.threads
where thread_id > 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PRIMARY NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`THREAD_ID` > 1)
explain select * from performance_schema.threads
where thread_id < 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PRIMARY NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`THREAD_ID` < 1)
select processlist_id = @conid, name, processlist_info
from performance_schema.threads
where thread_id = @tid;
processlist_id = @conid name processlist_info
1 thread/sql/one_connection <info>
explain select THREAD_ID, NAME from performance_schema.threads
where processlist_id = @conid;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ID PROCESSLIST_ID 9 const 10 100.00 NULL
explain select * from performance_schema.threads
where processlist_id > 99999;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_ID NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_ID` > 99999)
explain select * from performance_schema.threads
where processlist_id < 99999;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_ID NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_ID` < 99999)
select thread_id = @tid, name, processlist_info
from performance_schema.threads
where processlist_id = @conid;
thread_id = @tid name processlist_info
1 thread/sql/one_connection <info>
explain select THREAD_ID, NAME from performance_schema.threads
where thread_os_id = @osid;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref THREAD_OS_ID THREAD_OS_ID 9 const 10 100.00 NULL
explain select * from performance_schema.threads
where thread_os_id > 99999;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL THREAD_OS_ID NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`THREAD_OS_ID` > 99999)
explain select * from performance_schema.threads
where thread_os_id < 99999;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL THREAD_OS_ID NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`THREAD_OS_ID` < 99999)
select thread_id - @tid, name, processlist_info
from performance_schema.threads
where thread_os_id = @osid;
thread_id - @tid name processlist_info
0 thread/sql/one_connection <info>
explain select THREAD_ID from performance_schema.threads
where NAME = "impossible";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref NAME NAME 514 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`NAME` = 'impossible')
explain select THREAD_ID from performance_schema.threads
where NAME = "thread/sql/main";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref NAME NAME 514 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`NAME` = 'thread/sql/main')
explain select * from performance_schema.threads
where NAME > "foo";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL NAME NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`NAME` > 'foo')
explain select * from performance_schema.threads
where NAME < "bar";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL NAME NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`NAME` < 'bar')
explain select * from performance_schema.threads
where NAME like "thread/sql/%";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL NAME NULL NULL NULL 256 11.11 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`NAME` like 'thread/sql/%')
select thread_id, name, processlist_state, processlist_info
from performance_schema.threads
where NAME = "thread/sql/main" order by thread_id;
thread_id name processlist_state processlist_info
<thread_id> thread/sql/main <state> <info>
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_USER = "impossible";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT PROCESSLIST_ACCOUNT 131 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_USER` = 'impossible')
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_USER = "root";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT PROCESSLIST_ACCOUNT 131 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_USER` = 'root')
explain select * from performance_schema.threads
where PROCESSLIST_USER > "foo";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_ACCOUNT NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_USER` > 'foo')
explain select * from performance_schema.threads
where PROCESSLIST_USER < "bar";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_ACCOUNT NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_USER` < 'bar')
explain select * from performance_schema.threads
where PROCESSLIST_USER like "ro%";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_ACCOUNT NULL NULL NULL 256 11.11 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_USER` like 'ro%')
select thread_id, thread_id = @tid, name, processlist_state, processlist_info
from performance_schema.threads
where PROCESSLIST_USER = "root" order by thread_id;
thread_id thread_id = @tid name processlist_state processlist_info
<thread_id> 1 thread/sql/one_connection <state> <info>
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_USER = "impossible" and PROCESSLIST_HOST = "impossible";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT,PROCESSLIST_HOST PROCESSLIST_ACCOUNT 389 const,const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where ((`performance_schema`.`threads`.`PROCESSLIST_HOST` = 'impossible') and (`performance_schema`.`threads`.`PROCESSLIST_USER` = 'impossible'))
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_USER = "root" and PROCESSLIST_HOST = "localhost";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT,PROCESSLIST_HOST PROCESSLIST_ACCOUNT 389 const,const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where ((`performance_schema`.`threads`.`PROCESSLIST_HOST` = 'localhost') and (`performance_schema`.`threads`.`PROCESSLIST_USER` = 'root'))
explain select * from performance_schema.threads
where PROCESSLIST_USER = "foo" and PROCESSLIST_HOST < "foo";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT,PROCESSLIST_HOST PROCESSLIST_ACCOUNT 131 const 10 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where ((`performance_schema`.`threads`.`PROCESSLIST_USER` = 'foo') and (`performance_schema`.`threads`.`PROCESSLIST_HOST` < 'foo'))
explain select * from performance_schema.threads
where PROCESSLIST_USER = "foo" and PROCESSLIST_HOST > "bar";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT,PROCESSLIST_HOST PROCESSLIST_ACCOUNT 131 const 10 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where ((`performance_schema`.`threads`.`PROCESSLIST_USER` = 'foo') and (`performance_schema`.`threads`.`PROCESSLIST_HOST` > 'bar'))
explain select * from performance_schema.threads
where PROCESSLIST_USER = "foo" and PROCESSLIST_HOST like "bar%";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_ACCOUNT,PROCESSLIST_HOST PROCESSLIST_ACCOUNT 131 const 10 11.11 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where ((`performance_schema`.`threads`.`PROCESSLIST_USER` = 'foo') and (`performance_schema`.`threads`.`PROCESSLIST_HOST` like 'bar%'))
select thread_id, thread_id = @tid, name, processlist_state, processlist_info
from performance_schema.threads
where PROCESSLIST_USER = "root" and PROCESSLIST_HOST = "localhost" order by thread_id;
thread_id thread_id = @tid name processlist_state processlist_info
<thread_id> 1 thread/sql/one_connection <state> <info>
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_HOST = "impossible";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_HOST PROCESSLIST_HOST 258 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_HOST` = 'impossible')
explain select THREAD_ID from performance_schema.threads
where PROCESSLIST_HOST = "localhost";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ref PROCESSLIST_HOST PROCESSLIST_HOST 258 const 10 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_HOST` = 'localhost')
explain select * from performance_schema.threads
where PROCESSLIST_HOST > "foo";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_HOST NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_HOST` > 'foo')
explain select * from performance_schema.threads
where PROCESSLIST_HOST < "bar";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_HOST NULL NULL NULL 256 33.33 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_HOST` < 'bar')
explain select * from performance_schema.threads
where PROCESSLIST_HOST like "local%";
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL PROCESSLIST_HOST NULL NULL NULL 256 11.11 Using where
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads` where (`performance_schema`.`threads`.`PROCESSLIST_HOST` like 'local%')
select thread_id, thread_id = @tid, name, processlist_state, processlist_info
from performance_schema.threads
where PROCESSLIST_HOST = "localhost" order by (thread_id = @tid), thread_id;
thread_id thread_id = @tid name processlist_state processlist_info
<thread_id> 0 thread/sql/event_scheduler <state> <info>
<thread_id> 1 thread/sql/one_connection <state> <info>
|