| 1 |
# Performance schema tests generally depend on specific query plans |
| 2 |
# and behavior, and much of the perfschema suite is therefore disabled |
| 3 |
# if the hypergraph optimizer is active. |
| 4 |
--source include/not_hypergraph.inc |
| 5 |
|
| 6 |
# Tests for PERFORMANCE_SCHEMA |
| 7 |
|
| 8 |
# Setup |
| 9 |
let $select_column = SUM_ERRORS; |
| 10 |
let $table = performance_schema.prepared_statements_instances; |
| 11 |
|
| 12 |
delimiter //; |
| 13 |
|
| 14 |
create procedure proc1(a int, b int) |
| 15 |
BEGIN |
| 16 |
prepare st1 from 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; |
| 17 |
execute st1 using @a, @b; |
| 18 |
END // |
| 19 |
|
| 20 |
delimiter ;// |
| 21 |
|
| 22 |
SET @a = 3; |
| 23 |
SET @b = 4; |
| 24 |
call proc1(@a, @b); |
| 25 |
|
| 26 |
select OBJECT_INSTANCE_BEGIN, STATEMENT_ID, STATEMENT_NAME, |
| 27 |
OWNER_THREAD_ID, OWNER_EVENT_ID, |
| 28 |
OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME |
| 29 |
from performance_schema.prepared_statements_instances |
| 30 |
limit 1 |
| 31 |
into @oib, @stmt_id, @stmt_name, @o_tid, @o_eid, |
| 32 |
@o_otype, @o_oschema, @o_oname; |
| 33 |
|
| 34 |
########################################################################### |
| 35 |
# Test index on OBJECT_INSTANCE_BEGIN |
| 36 |
########################################################################### |
| 37 |
|
| 38 |
let $column_count = 1; |
| 39 |
let $col1 = OBJECT_INSTANCE_BEGIN; |
| 40 |
let $col1_act = @oib; |
| 41 |
|
| 42 |
--source ../include/idx_explain_test.inc |
| 43 |
|
| 44 |
########################################################################### |
| 45 |
# Test index on STATEMENT_ID |
| 46 |
########################################################################### |
| 47 |
|
| 48 |
let $column_count = 1; |
| 49 |
let $col1 = STATEMENT_ID; |
| 50 |
let $col1_act = @stmt_id; |
| 51 |
|
| 52 |
--source ../include/idx_explain_test.inc |
| 53 |
|
| 54 |
########################################################################### |
| 55 |
# Test index on STATEMENT_NAME |
| 56 |
########################################################################### |
| 57 |
|
| 58 |
let $column_count = 1; |
| 59 |
let $col1 = STATEMENT_NAME; |
| 60 |
let $col1_act = @stmt_name; |
| 61 |
|
| 62 |
--source ../include/idx_explain_test.inc |
| 63 |
|
| 64 |
########################################################################### |
| 65 |
# Test index on OWNER_THREAD_ID, OWNER_EVENT_ID |
| 66 |
########################################################################### |
| 67 |
|
| 68 |
let $column_count = 2; |
| 69 |
let $col1 = OWNER_THREAD_ID; |
| 70 |
let $col2= OWNER_EVENT_ID; |
| 71 |
let $col1_act = @o_tid; |
| 72 |
let $col2_act = @o_eid; |
| 73 |
|
| 74 |
--source ../include/idx_explain_test.inc |
| 75 |
|
| 76 |
########################################################################### |
| 77 |
# Test index on OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME |
| 78 |
########################################################################### |
| 79 |
|
| 80 |
let $column_count = 3; |
| 81 |
let $col1 = OWNER_OBJECT_TYPE; |
| 82 |
let $col2 = OWNER_OBJECT_SCHEMA; |
| 83 |
let $col3 = OWNER_OBJECT_NAME; |
| 84 |
let $col1_act = @o_otype; |
| 85 |
let $col2_act = @o_oschema; |
| 86 |
let $col3_act = @o_oname; |
| 87 |
|
| 88 |
--source ../include/idx_explain_test.inc |
| 89 |
|
| 90 |
# Cleanup |
| 91 |
deallocate prepare st1; |
| 92 |
drop procedure proc1; |