| 1 |
create procedure proc1(a int, b int) |
| 2 |
BEGIN |
| 3 |
prepare st1 from 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; |
| 4 |
execute st1 using @a, @b; |
| 5 |
END // |
| 6 |
SET @a = 3; |
| 7 |
SET @b = 4; |
| 8 |
call proc1(@a, @b); |
| 9 |
hypotenuse |
| 10 |
5 |
| 11 |
select OBJECT_INSTANCE_BEGIN, STATEMENT_ID, STATEMENT_NAME, |
| 12 |
OWNER_THREAD_ID, OWNER_EVENT_ID, |
| 13 |
OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME |
| 14 |
from performance_schema.prepared_statements_instances |
| 15 |
limit 1 |
| 16 |
into @oib, @stmt_id, @stmt_name, @o_tid, @o_eid, |
| 17 |
@o_otype, @o_oschema, @o_oname; |
| 18 |
|
| 19 |
==================================================================== |
| 20 |
Testing index for columns OBJECT_INSTANCE_BEGIN |
| 21 |
==================================================================== |
| 22 |
############ Explain for Query #################################### |
| 23 |
explain select SUM_ERRORS |
| 24 |
from performance_schema.prepared_statements_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 NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 28 |
############ Explain for Query #################################### |
| 29 |
explain select SUM_ERRORS |
| 30 |
from performance_schema.prepared_statements_instances |
| 31 |
where OBJECT_INSTANCE_BEGIN > "impossible"; |
| 32 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 33 |
1 SIMPLE prepared_statements_instances NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 34 |
############ Explain for Query #################################### |
| 35 |
explain select SUM_ERRORS |
| 36 |
from performance_schema.prepared_statements_instances |
| 37 |
where OBJECT_INSTANCE_BEGIN < "2"; |
| 38 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 39 |
1 SIMPLE prepared_statements_instances NULL ALL PRIMARY NULL NULL NULL # 33.33 Using where |
| 40 |
############ Explain for Query #################################### |
| 41 |
explain select SUM_ERRORS |
| 42 |
from performance_schema.prepared_statements_instances |
| 43 |
where OBJECT_INSTANCE_BEGIN = @oib; |
| 44 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 45 |
1 SIMPLE prepared_statements_instances NULL const PRIMARY PRIMARY 8 const # 100.00 NULL |
| 46 |
############# Explain End ######################################### |
| 47 |
flush status; |
| 48 |
select SUM_ERRORS |
| 49 |
from performance_schema.prepared_statements_instances |
| 50 |
where OBJECT_INSTANCE_BEGIN = @oib; |
| 51 |
SUM_ERRORS |
| 52 |
# |
| 53 |
OK: handler_read_key incremented |
| 54 |
|
| 55 |
==================================================================== |
| 56 |
Testing index for columns STATEMENT_ID |
| 57 |
==================================================================== |
| 58 |
############ Explain for Query #################################### |
| 59 |
explain select SUM_ERRORS |
| 60 |
from performance_schema.prepared_statements_instances |
| 61 |
where STATEMENT_ID = "impossible"; |
| 62 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 63 |
1 SIMPLE prepared_statements_instances NULL ref STATEMENT_ID STATEMENT_ID 8 const # 100.00 Using where |
| 64 |
############ Explain for Query #################################### |
| 65 |
explain select SUM_ERRORS |
| 66 |
from performance_schema.prepared_statements_instances |
| 67 |
where STATEMENT_ID > "impossible"; |
| 68 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 69 |
1 SIMPLE prepared_statements_instances NULL ALL STATEMENT_ID NULL NULL NULL # 33.33 Using where |
| 70 |
############ Explain for Query #################################### |
| 71 |
explain select SUM_ERRORS |
| 72 |
from performance_schema.prepared_statements_instances |
| 73 |
where STATEMENT_ID < "2"; |
| 74 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 75 |
1 SIMPLE prepared_statements_instances NULL ALL STATEMENT_ID NULL NULL NULL # 33.33 Using where |
| 76 |
############ Explain for Query #################################### |
| 77 |
explain select SUM_ERRORS |
| 78 |
from performance_schema.prepared_statements_instances |
| 79 |
where STATEMENT_ID = @stmt_id; |
| 80 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 81 |
1 SIMPLE prepared_statements_instances NULL ref STATEMENT_ID STATEMENT_ID 8 const # 100.00 NULL |
| 82 |
############# Explain End ######################################### |
| 83 |
flush status; |
| 84 |
select SUM_ERRORS |
| 85 |
from performance_schema.prepared_statements_instances |
| 86 |
where STATEMENT_ID = @stmt_id; |
| 87 |
SUM_ERRORS |
| 88 |
# |
| 89 |
OK: handler_read_key incremented |
| 90 |
|
| 91 |
==================================================================== |
| 92 |
Testing index for columns STATEMENT_NAME |
| 93 |
==================================================================== |
| 94 |
############ Explain for Query #################################### |
| 95 |
explain select SUM_ERRORS |
| 96 |
from performance_schema.prepared_statements_instances |
| 97 |
where STATEMENT_NAME = "impossible"; |
| 98 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 99 |
1 SIMPLE prepared_statements_instances NULL ref STATEMENT_NAME STATEMENT_NAME 259 const # 100.00 NULL |
| 100 |
############ Explain for Query #################################### |
| 101 |
explain select SUM_ERRORS |
| 102 |
from performance_schema.prepared_statements_instances |
| 103 |
where STATEMENT_NAME > "impossible"; |
| 104 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 105 |
1 SIMPLE prepared_statements_instances NULL ALL STATEMENT_NAME NULL NULL NULL # 33.33 Using where |
| 106 |
############ Explain for Query #################################### |
| 107 |
explain select SUM_ERRORS |
| 108 |
from performance_schema.prepared_statements_instances |
| 109 |
where STATEMENT_NAME < "2"; |
| 110 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 111 |
1 SIMPLE prepared_statements_instances NULL ALL STATEMENT_NAME NULL NULL NULL # 33.33 Using where |
| 112 |
############ Explain for Query #################################### |
| 113 |
explain select SUM_ERRORS |
| 114 |
from performance_schema.prepared_statements_instances |
| 115 |
where STATEMENT_NAME = @stmt_name; |
| 116 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 117 |
1 SIMPLE prepared_statements_instances NULL ref STATEMENT_NAME STATEMENT_NAME 259 const # 100.00 NULL |
| 118 |
############# Explain End ######################################### |
| 119 |
flush status; |
| 120 |
select SUM_ERRORS |
| 121 |
from performance_schema.prepared_statements_instances |
| 122 |
where STATEMENT_NAME = @stmt_name; |
| 123 |
SUM_ERRORS |
| 124 |
# |
| 125 |
OK: handler_read_key incremented |
| 126 |
|
| 127 |
==================================================================== |
| 128 |
Testing index for columns OWNER_THREAD_ID, OWNER_EVENT_ID |
| 129 |
==================================================================== |
| 130 |
############ Explain for Query #################################### |
| 131 |
explain select SUM_ERRORS |
| 132 |
from performance_schema.prepared_statements_instances |
| 133 |
where OWNER_THREAD_ID = "impossible"; |
| 134 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 135 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 8 const # 100.00 Using where |
| 136 |
############ Explain for Query #################################### |
| 137 |
explain select SUM_ERRORS |
| 138 |
from performance_schema.prepared_statements_instances |
| 139 |
where OWNER_THREAD_ID > "impossible"; |
| 140 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 141 |
1 SIMPLE prepared_statements_instances NULL ALL OWNER_THREAD_ID NULL NULL NULL # 33.33 Using where |
| 142 |
############ Explain for Query #################################### |
| 143 |
explain select SUM_ERRORS |
| 144 |
from performance_schema.prepared_statements_instances |
| 145 |
where OWNER_THREAD_ID < "2"; |
| 146 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 147 |
1 SIMPLE prepared_statements_instances NULL ALL OWNER_THREAD_ID NULL NULL NULL # 33.33 Using where |
| 148 |
############ Explain for Query #################################### |
| 149 |
explain select SUM_ERRORS |
| 150 |
from performance_schema.prepared_statements_instances |
| 151 |
where OWNER_THREAD_ID = @o_tid; |
| 152 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 153 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 8 const # 100.00 NULL |
| 154 |
############ Explain for Query #################################### |
| 155 |
explain select SUM_ERRORS |
| 156 |
from performance_schema.prepared_statements_instances |
| 157 |
where OWNER_THREAD_ID = "impossible" |
| 158 |
and OWNER_EVENT_ID = "impossible"; |
| 159 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 160 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 161 |
############ Explain for Query #################################### |
| 162 |
explain select SUM_ERRORS |
| 163 |
from performance_schema.prepared_statements_instances |
| 164 |
where OWNER_THREAD_ID = @o_tid |
| 165 |
and OWNER_EVENT_ID = "impossible"; |
| 166 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 167 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # NULL no matching row in const table |
| 168 |
############ Explain for Query #################################### |
| 169 |
explain select SUM_ERRORS |
| 170 |
from performance_schema.prepared_statements_instances |
| 171 |
where OWNER_THREAD_ID = @o_tid |
| 172 |
and OWNER_EVENT_ID > "impossible"; |
| 173 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 174 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 8 const # 33.33 Using where |
| 175 |
############ Explain for Query #################################### |
| 176 |
explain select SUM_ERRORS |
| 177 |
from performance_schema.prepared_statements_instances |
| 178 |
where OWNER_THREAD_ID = @o_tid |
| 179 |
and OWNER_EVENT_ID < "2"; |
| 180 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 181 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_THREAD_ID OWNER_THREAD_ID 8 const # 33.33 Using where |
| 182 |
############ Explain for Query #################################### |
| 183 |
explain select SUM_ERRORS |
| 184 |
from performance_schema.prepared_statements_instances |
| 185 |
where OWNER_THREAD_ID = @o_tid |
| 186 |
and OWNER_EVENT_ID = @o_eid; |
| 187 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 188 |
1 SIMPLE prepared_statements_instances NULL const OWNER_THREAD_ID OWNER_THREAD_ID 16 const,const # 100.00 NULL |
| 189 |
############# Explain End ######################################### |
| 190 |
flush status; |
| 191 |
select SUM_ERRORS |
| 192 |
from performance_schema.prepared_statements_instances |
| 193 |
where OWNER_THREAD_ID = @o_tid |
| 194 |
and OWNER_EVENT_ID = @o_eid; |
| 195 |
SUM_ERRORS |
| 196 |
# |
| 197 |
OK: handler_read_key incremented |
| 198 |
|
| 199 |
==================================================================== |
| 200 |
Testing index for columns OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME |
| 201 |
==================================================================== |
| 202 |
############ Explain for Query #################################### |
| 203 |
explain select SUM_ERRORS |
| 204 |
from performance_schema.prepared_statements_instances |
| 205 |
where OWNER_OBJECT_TYPE = "impossible"; |
| 206 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 207 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 2 const # 100.00 Using where |
| 208 |
############ Explain for Query #################################### |
| 209 |
explain select SUM_ERRORS |
| 210 |
from performance_schema.prepared_statements_instances |
| 211 |
where OWNER_OBJECT_TYPE > "impossible"; |
| 212 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 213 |
1 SIMPLE prepared_statements_instances NULL ALL OWNER_OBJECT_TYPE NULL NULL NULL # 33.33 Using where |
| 214 |
############ Explain for Query #################################### |
| 215 |
explain select SUM_ERRORS |
| 216 |
from performance_schema.prepared_statements_instances |
| 217 |
where OWNER_OBJECT_TYPE < "2"; |
| 218 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 219 |
1 SIMPLE prepared_statements_instances NULL ALL OWNER_OBJECT_TYPE NULL NULL NULL # 33.33 Using where |
| 220 |
############ Explain for Query #################################### |
| 221 |
explain select SUM_ERRORS |
| 222 |
from performance_schema.prepared_statements_instances |
| 223 |
where OWNER_OBJECT_TYPE = @o_otype; |
| 224 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 225 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 2 const # 100.00 Using where |
| 226 |
############ Explain for Query #################################### |
| 227 |
explain select SUM_ERRORS |
| 228 |
from performance_schema.prepared_statements_instances |
| 229 |
where OWNER_OBJECT_TYPE = "impossible" |
| 230 |
and OWNER_OBJECT_SCHEMA = "impossible"; |
| 231 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 232 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 261 const,const # 100.00 Using where |
| 233 |
############ Explain for Query #################################### |
| 234 |
explain select SUM_ERRORS |
| 235 |
from performance_schema.prepared_statements_instances |
| 236 |
where OWNER_OBJECT_TYPE = @o_otype |
| 237 |
and OWNER_OBJECT_SCHEMA = "impossible"; |
| 238 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 239 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 261 const,const # 100.00 Using where |
| 240 |
############ Explain for Query #################################### |
| 241 |
explain select SUM_ERRORS |
| 242 |
from performance_schema.prepared_statements_instances |
| 243 |
where OWNER_OBJECT_TYPE = @o_otype |
| 244 |
and OWNER_OBJECT_SCHEMA > "impossible"; |
| 245 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 246 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 2 const # 33.33 Using where |
| 247 |
############ Explain for Query #################################### |
| 248 |
explain select SUM_ERRORS |
| 249 |
from performance_schema.prepared_statements_instances |
| 250 |
where OWNER_OBJECT_TYPE = @o_otype |
| 251 |
and OWNER_OBJECT_SCHEMA < "2"; |
| 252 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 253 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 2 const # 33.33 Using where |
| 254 |
############ Explain for Query #################################### |
| 255 |
explain select SUM_ERRORS |
| 256 |
from performance_schema.prepared_statements_instances |
| 257 |
where OWNER_OBJECT_TYPE = @o_otype |
| 258 |
and OWNER_OBJECT_SCHEMA = @o_oschema; |
| 259 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 260 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 261 const,const # 100.00 Using where |
| 261 |
############ Explain for Query #################################### |
| 262 |
explain select SUM_ERRORS |
| 263 |
from performance_schema.prepared_statements_instances |
| 264 |
where OWNER_OBJECT_TYPE = "impossible" |
| 265 |
and OWNER_OBJECT_SCHEMA = "impossible" |
| 266 |
and OWNER_OBJECT_NAME = "impossible"; |
| 267 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 268 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 520 const,const,const # 100.00 Using where |
| 269 |
############ Explain for Query #################################### |
| 270 |
explain select SUM_ERRORS |
| 271 |
from performance_schema.prepared_statements_instances |
| 272 |
where OWNER_OBJECT_TYPE = @o_otype |
| 273 |
and OWNER_OBJECT_SCHEMA = @o_oschema |
| 274 |
and OWNER_OBJECT_NAME = "impossible"; |
| 275 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 276 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 520 const,const,const # 100.00 Using where |
| 277 |
############ Explain for Query #################################### |
| 278 |
explain select SUM_ERRORS |
| 279 |
from performance_schema.prepared_statements_instances |
| 280 |
where OWNER_OBJECT_TYPE = @o_otype |
| 281 |
and OWNER_OBJECT_SCHEMA = @o_oschema |
| 282 |
and OWNER_OBJECT_NAME > "impossible"; |
| 283 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 284 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 261 const,const # 33.33 Using where |
| 285 |
############ Explain for Query #################################### |
| 286 |
explain select SUM_ERRORS |
| 287 |
from performance_schema.prepared_statements_instances |
| 288 |
where OWNER_OBJECT_TYPE = @o_otype |
| 289 |
and OWNER_OBJECT_SCHEMA = @o_oschema |
| 290 |
and OWNER_OBJECT_NAME < "2"; |
| 291 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 292 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 261 const,const # 33.33 Using where |
| 293 |
############ Explain for Query #################################### |
| 294 |
explain select SUM_ERRORS |
| 295 |
from performance_schema.prepared_statements_instances |
| 296 |
where OWNER_OBJECT_TYPE = @o_otype |
| 297 |
and OWNER_OBJECT_SCHEMA = @o_oschema |
| 298 |
and OWNER_OBJECT_NAME = @o_oname; |
| 299 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 300 |
1 SIMPLE prepared_statements_instances NULL ref OWNER_OBJECT_TYPE OWNER_OBJECT_TYPE 520 const,const,const # 100.00 Using where |
| 301 |
############# Explain End ######################################### |
| 302 |
flush status; |
| 303 |
select SUM_ERRORS |
| 304 |
from performance_schema.prepared_statements_instances |
| 305 |
where OWNER_OBJECT_TYPE = @o_otype |
| 306 |
and OWNER_OBJECT_SCHEMA = @o_oschema |
| 307 |
and OWNER_OBJECT_NAME = @o_oname; |
| 308 |
SUM_ERRORS |
| 309 |
# |
| 310 |
OK: handler_read_key incremented |
| 311 |
deallocate prepare st1; |
| 312 |
drop procedure proc1; |