| 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 = COUNT(*); |
| 10 |
let $table = performance_schema.data_locks; |
| 11 |
|
| 12 |
connect(con1, localhost, root,,); |
| 13 |
|
| 14 |
--echo # Connection con1 |
| 15 |
--connection con1 |
| 16 |
|
| 17 |
create database explain_test_db; |
| 18 |
create table explain_test_db.explain_test_table(a int, b int, PRIMARY KEY (a, b)) engine=innodb |
| 19 |
PARTITION BY RANGE( a ) |
| 20 |
SUBPARTITION BY HASH( b ) ( |
| 21 |
PARTITION p0 VALUES LESS THAN (1990) ( |
| 22 |
SUBPARTITION s0, |
| 23 |
SUBPARTITION s1 |
| 24 |
), |
| 25 |
PARTITION p1 VALUES LESS THAN (2000) ( |
| 26 |
SUBPARTITION s2, |
| 27 |
SUBPARTITION s3 |
| 28 |
), |
| 29 |
PARTITION p2 VALUES LESS THAN MAXVALUE ( |
| 30 |
SUBPARTITION s4, |
| 31 |
SUBPARTITION s5 |
| 32 |
) |
| 33 |
); |
| 34 |
|
| 35 |
insert into explain_test_db.explain_test_table values (1, 100), (1995, 200); |
| 36 |
|
| 37 |
start transaction; |
| 38 |
update explain_test_db.explain_test_table set b=b+1; |
| 39 |
|
| 40 |
--echo # Connection default |
| 41 |
--connection default |
| 42 |
|
| 43 |
# Debug |
| 44 |
# select * from performance_schema.data_locks; |
| 45 |
|
| 46 |
select ENGINE, ENGINE_LOCK_ID, ENGINE_TRANSACTION_ID, THREAD_ID, EVENT_ID, |
| 47 |
PARTITION_NAME, SUBPARTITION_NAME |
| 48 |
from performance_schema.data_locks |
| 49 |
where OBJECT_NAME = 'explain_test_table' |
| 50 |
and LOCK_TYPE = 'RECORD' and LOCK_DATA = '1, 100' |
| 51 |
into @engine, @lock_id, @trx_id, @thread_id, @event_id, @part, @subpart; |
| 52 |
|
| 53 |
# Debug |
| 54 |
# select @engine, @lock_id, @trx_id, @thread_id, @event_id, @part, @subpart; |
| 55 |
|
| 56 |
# Make sure this test found a record. |
| 57 |
select @engine is null, |
| 58 |
@lock_id is null, |
| 59 |
@trx_id is null, |
| 60 |
@thread_id is null, |
| 61 |
@event_id is null, |
| 62 |
@part, @subpart; |
| 63 |
|
| 64 |
########################################################################### |
| 65 |
# Test index on PRIMARY |
| 66 |
########################################################################### |
| 67 |
|
| 68 |
let $column_count = 2; |
| 69 |
let $col1 = ENGINE_LOCK_ID; |
| 70 |
let $col2 = ENGINE; |
| 71 |
let $col1_act = @lock_id; |
| 72 |
let $col2_act = @engine; |
| 73 |
|
| 74 |
--source ../include/idx_explain_test.inc |
| 75 |
|
| 76 |
########################################################################### |
| 77 |
# Test index on ENGINE_TRANSACTION_ID |
| 78 |
########################################################################### |
| 79 |
|
| 80 |
let $column_count = 2; |
| 81 |
let $col1 = ENGINE_TRANSACTION_ID; |
| 82 |
let $col2 = ENGINE; |
| 83 |
let $col1_act = @trx_id; |
| 84 |
let $col2_act = @engine; |
| 85 |
|
| 86 |
--source ../include/idx_explain_test.inc |
| 87 |
|
| 88 |
########################################################################### |
| 89 |
# Test index on THREAD_ID |
| 90 |
########################################################################### |
| 91 |
|
| 92 |
let $column_count = 2; |
| 93 |
let $col1 = THREAD_ID; |
| 94 |
let $col2 = EVENT_ID; |
| 95 |
let $col1_act = @thread_id; |
| 96 |
let $col2_act = @event_id; |
| 97 |
|
| 98 |
--source ../include/idx_explain_test.inc |
| 99 |
|
| 100 |
########################################################################### |
| 101 |
# Test index on OBJECT_SCHEMA, OBJECT_NAME, PARTITION_NAME, SUBPARTITION_NAME |
| 102 |
########################################################################### |
| 103 |
|
| 104 |
let $column_count = 4; |
| 105 |
let $col1 = OBJECT_SCHEMA; |
| 106 |
let $col2 = OBJECT_NAME; |
| 107 |
let $col3 = PARTITION_NAME; |
| 108 |
let $col4 = SUBPARTITION_NAME; |
| 109 |
let $col1_act = "explain_test_db"; |
| 110 |
let $col2_act = "explain_test_table"; |
| 111 |
let $col3_act = @part; |
| 112 |
let $col4_act = @subpart; |
| 113 |
|
| 114 |
--source ../include/idx_explain_test.inc |
| 115 |
|
| 116 |
# Cleanup |
| 117 |
|
| 118 |
--echo # Connection con1 |
| 119 |
--connection con1 |
| 120 |
commit; |
| 121 |
drop table explain_test_db.explain_test_table; |
| 122 |
drop database explain_test_db; |
| 123 |
|
| 124 |
--echo # Connection default |
| 125 |
--connection default |
| 126 |
--disconnect con1 |