| 1 |
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; |
| 2 |
UPDATE performance_schema.setup_instruments SET enabled = 'YES' |
| 3 |
WHERE name LIKE 'wait/synch/mutex/%' |
| 4 |
OR name LIKE 'wait/synch/rwlock/%'; |
| 5 |
truncate table performance_schema.events_statements_summary_by_digest; |
| 6 |
flush status; |
| 7 |
select NAME from performance_schema.mutex_instances |
| 8 |
where NAME = 'wait/synch/mutex/sql/LOCK_open'; |
| 9 |
NAME |
| 10 |
wait/synch/mutex/sql/LOCK_open |
| 11 |
DROP TABLE IF EXISTS t1; |
| 12 |
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') |
| 13 |
ENGINE=MyISAM; |
| 14 |
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); |
| 15 |
TRUNCATE TABLE performance_schema.events_waits_history_long; |
| 16 |
TRUNCATE TABLE performance_schema.events_waits_history; |
| 17 |
TRUNCATE TABLE performance_schema.events_waits_current; |
| 18 |
SELECT * FROM t1 WHERE id = 1; |
| 19 |
id b |
| 20 |
1 initial value |
| 21 |
CREATE TABLE t2 SELECT * FROM performance_schema.events_waits_history_long |
| 22 |
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache'); |
| 23 |
SET @before_count = (SELECT SUM(TIMER_WAIT) FROM t2); |
| 24 |
TRUNCATE TABLE performance_schema.events_waits_history_long; |
| 25 |
SELECT * FROM t1; |
| 26 |
id b |
| 27 |
1 initial value |
| 28 |
2 initial value |
| 29 |
3 initial value |
| 30 |
4 initial value |
| 31 |
5 initial value |
| 32 |
6 initial value |
| 33 |
7 initial value |
| 34 |
8 initial value |
| 35 |
INSERT INTO t2 SELECT * FROM performance_schema.events_waits_history_long |
| 36 |
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache'); |
| 37 |
SET @after_count = (SELECT SUM(TIMER_WAIT) FROM t2); |
| 38 |
SELECT IF(@after_count < @before_count, 'Failue', 'Success') test_fm1_timed; |
| 39 |
test_fm1_timed |
| 40 |
Success |
| 41 |
DROP TABLE t2; |
| 42 |
UPDATE performance_schema.setup_instruments SET enabled = 'NO' |
| 43 |
WHERE NAME = 'wait/synch/mutex/sql/LOCK_table_cache'; |
| 44 |
TRUNCATE TABLE performance_schema.events_waits_history_long; |
| 45 |
TRUNCATE TABLE performance_schema.events_waits_history; |
| 46 |
TRUNCATE TABLE performance_schema.events_waits_current; |
| 47 |
SELECT * FROM t1 WHERE id = 1; |
| 48 |
id b |
| 49 |
1 initial value |
| 50 |
SET @before_count = (SELECT SUM(TIMER_WAIT) |
| 51 |
FROM performance_schema.events_waits_history_long |
| 52 |
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); |
| 53 |
SELECT * FROM t1; |
| 54 |
id b |
| 55 |
1 initial value |
| 56 |
2 initial value |
| 57 |
3 initial value |
| 58 |
4 initial value |
| 59 |
5 initial value |
| 60 |
6 initial value |
| 61 |
7 initial value |
| 62 |
8 initial value |
| 63 |
SET @after_count = (SELECT SUM(TIMER_WAIT) |
| 64 |
FROM performance_schema.events_waits_history_long |
| 65 |
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); |
| 66 |
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; |
| 67 |
test_fm2_timed |
| 68 |
Success |
| 69 |
UPDATE performance_schema.setup_instruments SET enabled = 'YES'; |
| 70 |
DROP TABLE t1; |
| 71 |
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; |
| 72 |
show global status like "performance_schema%_lost"; |
| 73 |
Variable_name Value |
| 74 |
Performance_schema_accounts_lost 0 |
| 75 |
Performance_schema_cond_classes_lost 0 |
| 76 |
Performance_schema_cond_instances_lost 0 |
| 77 |
Performance_schema_digest_lost 0 |
| 78 |
Performance_schema_file_classes_lost 0 |
| 79 |
Performance_schema_file_handles_lost 0 |
| 80 |
Performance_schema_file_instances_lost 0 |
| 81 |
Performance_schema_hosts_lost 0 |
| 82 |
Performance_schema_index_stat_lost 0 |
| 83 |
Performance_schema_locker_lost 0 |
| 84 |
Performance_schema_memory_classes_lost 0 |
| 85 |
Performance_schema_metadata_lock_lost 0 |
| 86 |
Performance_schema_mutex_classes_lost 0 |
| 87 |
Performance_schema_mutex_instances_lost 0 |
| 88 |
Performance_schema_nested_statement_lost 0 |
| 89 |
Performance_schema_prepared_statements_lost 0 |
| 90 |
Performance_schema_program_lost 0 |
| 91 |
Performance_schema_rwlock_classes_lost 0 |
| 92 |
Performance_schema_rwlock_instances_lost 0 |
| 93 |
Performance_schema_session_connect_attrs_lost 0 |
| 94 |
Performance_schema_socket_classes_lost 0 |
| 95 |
Performance_schema_socket_instances_lost 0 |
| 96 |
Performance_schema_stage_classes_lost 0 |
| 97 |
Performance_schema_statement_classes_lost 0 |
| 98 |
Performance_schema_table_handles_lost 0 |
| 99 |
Performance_schema_table_instances_lost 0 |
| 100 |
Performance_schema_table_lock_stat_lost 0 |
| 101 |
Performance_schema_thread_classes_lost 0 |
| 102 |
Performance_schema_thread_instances_lost 0 |
| 103 |
Performance_schema_users_lost 0 |