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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
|
set global innodb_monitor_disable = All;
select name, status from information_schema.innodb_metrics;
name status
metadata_table_handles_opened disabled
metadata_table_handles_closed disabled
metadata_table_reference_count disabled
lock_deadlocks disabled
lock_timeouts disabled
lock_rec_lock_waits disabled
lock_table_lock_waits disabled
lock_rec_lock_requests disabled
lock_rec_lock_created disabled
lock_rec_lock_removed disabled
lock_rec_locks disabled
lock_table_lock_created disabled
lock_table_lock_removed disabled
lock_table_locks disabled
lock_row_lock_current_waits disabled
lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
buffer_pool_size disabled
buffer_pool_reads disabled
buffer_pool_read_requests disabled
buffer_pool_write_requests disabled
buffer_pool_wait_free disabled
buffer_pool_read_ahead disabled
buffer_pool_read_ahead_evicted disabled
buffer_pool_pages_total disabled
buffer_pool_pages_misc disabled
buffer_pool_pages_data disabled
buffer_pool_bytes_data disabled
buffer_pool_pages_dirty disabled
buffer_pool_bytes_dirty disabled
buffer_pool_pages_free disabled
buffer_pages_created disabled
buffer_pages_written disabled
buffer_pages_read disabled
buffer_index_sec_rec_cluster_reads disabled
buffer_index_sec_rec_cluster_reads_avoided disabled
buffer_data_reads disabled
buffer_data_written disabled
buffer_flush_batch_scanned disabled
buffer_flush_batch_num_scan disabled
buffer_flush_batch_scanned_per_call disabled
buffer_flush_batch_total_pages disabled
buffer_flush_batches disabled
buffer_flush_batch_pages disabled
buffer_flush_neighbor_total_pages disabled
buffer_flush_neighbor disabled
buffer_flush_neighbor_pages disabled
buffer_flush_n_to_flush_requested disabled
buffer_flush_n_to_flush_by_age disabled
buffer_flush_adaptive_avg_time_slot disabled
buffer_LRU_batch_flush_avg_time_slot disabled
buffer_flush_adaptive_avg_time_thread disabled
buffer_LRU_batch_flush_avg_time_thread disabled
buffer_flush_adaptive_avg_time_est disabled
buffer_LRU_batch_flush_avg_time_est disabled
buffer_flush_avg_time disabled
buffer_flush_adaptive_avg_pass disabled
buffer_LRU_batch_flush_avg_pass disabled
buffer_flush_avg_pass disabled
buffer_LRU_get_free_loops disabled
buffer_LRU_get_free_waits disabled
buffer_flush_avg_page_rate disabled
buffer_flush_lsn_avg_rate disabled
buffer_flush_pct_for_dirty disabled
buffer_flush_pct_for_lsn disabled
buffer_flush_sync_waits disabled
buffer_flush_adaptive_total_pages disabled
buffer_flush_adaptive disabled
buffer_flush_adaptive_pages disabled
buffer_flush_sync_total_pages disabled
buffer_flush_sync disabled
buffer_flush_sync_pages disabled
buffer_flush_background_total_pages disabled
buffer_flush_background disabled
buffer_flush_background_pages disabled
buffer_LRU_batch_scanned disabled
buffer_LRU_batch_num_scan disabled
buffer_LRU_batch_scanned_per_call disabled
buffer_LRU_batch_flush_total_pages disabled
buffer_LRU_batches_flush disabled
buffer_LRU_batch_flush_pages disabled
buffer_LRU_batch_evict_total_pages disabled
buffer_LRU_batches_evict disabled
buffer_LRU_batch_evict_pages disabled
buffer_LRU_single_flush_scanned disabled
buffer_LRU_single_flush_num_scan disabled
buffer_LRU_single_flush_scanned_per_call disabled
buffer_LRU_single_flush_failure_count disabled
buffer_LRU_get_free_search disabled
buffer_LRU_search_scanned disabled
buffer_LRU_search_num_scan disabled
buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
buffer_page_read_index_ibuf_non_leaf disabled
buffer_page_read_undo_log disabled
buffer_page_read_index_inode disabled
buffer_page_read_ibuf_free_list disabled
buffer_page_read_ibuf_bitmap disabled
buffer_page_read_system_page disabled
buffer_page_read_trx_system disabled
buffer_page_read_fsp_hdr disabled
buffer_page_read_xdes disabled
buffer_page_read_blob disabled
buffer_page_read_zblob disabled
buffer_page_read_zblob2 disabled
buffer_page_read_other disabled
buffer_page_written_index_leaf disabled
buffer_page_written_index_non_leaf disabled
buffer_page_written_index_ibuf_leaf disabled
buffer_page_written_index_ibuf_non_leaf disabled
buffer_page_written_undo_log disabled
buffer_page_written_index_inode disabled
buffer_page_written_ibuf_free_list disabled
buffer_page_written_ibuf_bitmap disabled
buffer_page_written_system_page disabled
buffer_page_written_trx_system disabled
buffer_page_written_fsp_hdr disabled
buffer_page_written_xdes disabled
buffer_page_written_blob disabled
buffer_page_written_zblob disabled
buffer_page_written_zblob2 disabled
buffer_page_written_other disabled
os_data_reads disabled
os_data_writes disabled
os_data_fsyncs disabled
os_pending_reads disabled
os_pending_writes disabled
os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
trx_commits_insert_update disabled
trx_rollbacks disabled
trx_rollbacks_savepoint disabled
trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
purge_undo_log_pages disabled
purge_dml_delay_usec disabled
purge_stop_count disabled
purge_resume_count disabled
log_checkpoints disabled
log_lsn_last_flush disabled
log_lsn_last_checkpoint disabled
log_lsn_current disabled
log_lsn_checkpoint_age disabled
log_lsn_buf_pool_oldest disabled
log_max_modified_age_async disabled
log_max_modified_age_sync disabled
log_pending_log_flushes disabled
log_pending_checkpoint_writes disabled
log_num_log_io disabled
log_waits disabled
log_write_requests disabled
log_writes disabled
log_padded disabled
compress_pages_compressed disabled
compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
index_page_reorg_attempts disabled
index_page_reorg_successful disabled
index_page_discards disabled
adaptive_hash_searches disabled
adaptive_hash_searches_btree disabled
adaptive_hash_pages_added disabled
adaptive_hash_pages_removed disabled
adaptive_hash_rows_added disabled
adaptive_hash_rows_removed disabled
adaptive_hash_rows_deleted_no_hash_entry disabled
adaptive_hash_rows_updated disabled
file_num_open_files disabled
ibuf_merges_insert disabled
ibuf_merges_delete_mark disabled
ibuf_merges_delete disabled
ibuf_merges_discard_insert disabled
ibuf_merges_discard_delete_mark disabled
ibuf_merges_discard_delete disabled
ibuf_merges disabled
ibuf_size disabled
innodb_master_thread_sleeps disabled
innodb_activity_count disabled
innodb_master_active_loops disabled
innodb_master_idle_loops disabled
innodb_background_drop_table_usec disabled
innodb_ibuf_merge_usec disabled
innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
innodb_dict_lru_usec disabled
innodb_dict_lru_count_active disabled
innodb_dict_lru_count_idle disabled
innodb_checkpoint_usec disabled
innodb_dblwr_writes disabled
innodb_dblwr_pages_written disabled
innodb_page_size disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_sx_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
innodb_rwlock_x_spin_rounds disabled
innodb_rwlock_sx_spin_rounds disabled
innodb_rwlock_s_os_waits disabled
innodb_rwlock_x_os_waits disabled
innodb_rwlock_sx_os_waits disabled
dml_reads disabled
dml_inserts disabled
dml_deletes disabled
dml_updates disabled
dml_system_reads disabled
dml_system_inserts disabled
dml_system_deletes disabled
dml_system_updates disabled
ddl_background_drop_indexes disabled
ddl_background_drop_tables disabled
ddl_online_create_index disabled
ddl_pending_alter_table disabled
ddl_sort_file_alter_table disabled
ddl_log_file_alter_table disabled
icp_attempts disabled
icp_no_match disabled
icp_out_of_range disabled
icp_match disabled
set global innodb_monitor_enable = all;
select name from information_schema.innodb_metrics where status!='enabled';
name
set global innodb_monitor_enable = aaa;
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa'
set global innodb_monitor_disable = All;
select name from information_schema.innodb_metrics where status!='disabled';
name
set global innodb_monitor_reset_all = all;
select name from information_schema.innodb_metrics where count!=0;
name
set global innodb_monitor_enable = "%lock%";
select name from information_schema.innodb_metrics
where status != IF(name like "%lock%", 'enabled', 'disabled');
name
set global innodb_monitor_disable = "%lock%";
select name, status from information_schema.innodb_metrics
where name like "%lock%";
name status
lock_deadlocks disabled
lock_timeouts disabled
lock_rec_lock_waits disabled
lock_table_lock_waits disabled
lock_rec_lock_requests disabled
lock_rec_lock_created disabled
lock_rec_lock_removed disabled
lock_rec_locks disabled
lock_table_lock_created disabled
lock_table_lock_removed disabled
lock_table_locks disabled
lock_row_lock_current_waits disabled
lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_sx_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
innodb_rwlock_x_spin_rounds disabled
innodb_rwlock_sx_spin_rounds disabled
innodb_rwlock_s_os_waits disabled
innodb_rwlock_x_os_waits disabled
innodb_rwlock_sx_os_waits disabled
set global innodb_monitor_enable = "%lock*";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*'
set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%";
select name from information_schema.innodb_metrics where status!='enabled';
name
set global innodb_monitor_disable="%%%%%";
select name from information_schema.innodb_metrics where status!='disabled';
name
set global innodb_monitor_enable="%";
select name from information_schema.innodb_metrics where status!='enabled';
name
set global innodb_monitor_disable="%_%";
select name from information_schema.innodb_metrics where status!='disabled';
name
set global innodb_monitor_enable="log%%%%";
select name from information_schema.innodb_metrics
where status != IF(name like "log%", 'enabled', 'disabled');
name
set global innodb_monitor_enable="os_%a_fs_ncs";
set global innodb_monitor_enable="os%pending%";
select name, status from information_schema.innodb_metrics
where name like "os%";
name status
os_data_reads disabled
os_data_writes disabled
os_data_fsyncs enabled
os_pending_reads enabled
os_pending_writes enabled
os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_'
SET global innodb_monitor_disable = module_metadata;
SET global innodb_monitor_reset_all = module_metadata;
set global innodb_monitor_enable = metadata_table_handles_opened;
create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled
drop table monitor_test;
create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled
set global innodb_monitor_disable = metadata_table_handles_opened;
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled
drop table monitor_test;
create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_enable = metadata_table_handles_opened;
drop table monitor_test;
create table monitor_test(col int) engine = innodb stats_persistent=0;
select * from monitor_test;
col
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled
set global innodb_monitor_enable = metadata_table_handles_closed;
create index idx on monitor_test(col);
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name = "metadata_table_handles_closed";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled
metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled
metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_disable = module_metadata;
set global innodb_monitor_reset = module_metadata;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled
metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled
metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_reset_all = module_metadata;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled
metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled
metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_enable = module_trx;
begin;
insert into monitor_test values(9);
commit;
begin;
insert into monitor_test values(9);
rollback;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "trx_rollbacks" or name like "trx_active_transactions";
name max_count min_count count max_count_reset min_count_reset count_reset status
trx_rollbacks 1 NULL 1 1 NULL 1 enabled
trx_active_transactions 1 0 0 1 0 0 enabled
set global innodb_monitor_disable = module_trx;
set global innodb_monitor_enable = module_dml;
insert into monitor_test values(9);
update monitor_test set col = 10 where col = 9;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 2 NULL 2 2 NULL 2 enabled
dml_inserts 1 NULL 1 1 NULL 1 enabled
dml_deletes 0 NULL 0 0 NULL 0 enabled
dml_updates 2 NULL 2 2 NULL 2 enabled
dml_system_reads 0 NULL 0 0 NULL 0 enabled
dml_system_inserts 0 NULL 0 0 NULL 0 enabled
dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
delete from monitor_test;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 4 NULL 4 4 NULL 4 enabled
dml_inserts 1 NULL 1 1 NULL 1 enabled
dml_deletes 2 NULL 2 2 NULL 2 enabled
dml_updates 2 NULL 2 2 NULL 2 enabled
dml_system_reads 0 NULL 0 0 NULL 0 enabled
dml_system_inserts 0 NULL 0 0 NULL 0 enabled
dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_reset = module_dml;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 4 NULL 4 0 NULL 0 enabled
dml_inserts 1 NULL 1 0 NULL 0 enabled
dml_deletes 2 NULL 2 0 NULL 0 enabled
dml_updates 2 NULL 2 0 NULL 0 enabled
dml_system_reads 0 NULL 0 0 NULL 0 enabled
dml_system_inserts 0 NULL 0 0 NULL 0 enabled
dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
insert into monitor_test values(9);
insert into monitor_test values(1);
delete from monitor_test;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 6 NULL 6 2 NULL 2 enabled
dml_inserts 3 NULL 3 2 NULL 2 enabled
dml_deletes 4 NULL 4 2 NULL 2 enabled
dml_updates 2 NULL 2 0 NULL 0 enabled
dml_system_reads 0 NULL 0 0 NULL 0 enabled
dml_system_inserts 0 NULL 0 0 NULL 0 enabled
dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 6 NULL 6 2 NULL 2 enabled
dml_inserts 3 NULL 3 2 NULL 2 enabled
dml_deletes 4 NULL 4 2 NULL 2 enabled
dml_updates 2 NULL 2 0 NULL 0 enabled
dml_system_reads 0 NULL 0 0 NULL 0 enabled
dml_system_inserts 0 NULL 0 0 NULL 0 enabled
dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_disable = module_dml;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads 6 NULL 6 2 NULL 2 disabled
dml_inserts 3 NULL 3 2 NULL 2 disabled
dml_deletes 4 NULL 4 2 NULL 2 disabled
dml_updates 2 NULL 2 0 NULL 0 disabled
dml_system_reads 0 NULL 0 0 NULL 0 disabled
dml_system_inserts 0 NULL 0 0 NULL 0 disabled
dml_system_deletes 0 NULL 0 0 NULL 0 disabled
dml_system_updates 0 NULL 0 0 NULL 0 disabled
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads NULL NULL 0 NULL NULL 0 disabled
dml_inserts NULL NULL 0 NULL NULL 0 disabled
dml_deletes NULL NULL 0 NULL NULL 0 disabled
dml_updates NULL NULL 0 NULL NULL 0 disabled
dml_system_reads NULL NULL 0 NULL NULL 0 disabled
dml_system_inserts NULL NULL 0 NULL NULL 0 disabled
dml_system_deletes NULL NULL 0 NULL NULL 0 disabled
dml_system_updates NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_enable = dml_inserts;
insert into monitor_test values(9);
insert into monitor_test values(1);
delete from monitor_test;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
dml_reads NULL NULL 0 NULL NULL 0 disabled
dml_inserts 2 NULL 2 2 NULL 2 enabled
dml_deletes NULL NULL 0 NULL NULL 0 disabled
dml_updates NULL NULL 0 NULL NULL 0 disabled
dml_system_reads NULL NULL 0 NULL NULL 0 disabled
dml_system_inserts NULL NULL 0 NULL NULL 0 disabled
dml_system_deletes NULL NULL 0 NULL NULL 0 disabled
dml_system_updates NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_disable = module_dml;
drop table monitor_test;
set global innodb_monitor_enable = file_num_open_files;
select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, status
from information_schema.innodb_metrics
where name like "file_num_open_files";
name max_count min_count count max_count_reset min_count_reset count_reset status
file_num_open_files # # # # # # enabled
set global innodb_monitor_disable = file_num_open_files;
set global innodb_monitor_enable = "icp%";
create table monitor_test(a char(3), b int, c char(2),
primary key (a(1), c(1)), key(b)) engine = innodb;
insert into monitor_test values("13", 2, "aa");
select a from monitor_test where b < 1 for update;
a
select name, count from information_schema.innodb_metrics
where name like "icp%";
name count
icp_attempts 1
icp_no_match 0
icp_out_of_range 1
icp_match 0
select a from monitor_test where b < 3 for update;
a
13
select name, count from information_schema.innodb_metrics
where name like "icp%";
name count
icp_attempts 2
icp_no_match 0
icp_out_of_range 1
icp_match 1
drop table monitor_test;
set global innodb_monitor_disable = All;
set global innodb_monitor_reset_all = all;
select 1 from `information_schema`.`INNODB_METRICS`
where case (1) when (1) then (AVG_COUNT_RESET) else (1) end;
1
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
#
# Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL
# MONITORS
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 0
SET GLOBAL innodb_monitor_enable='module_buffer_page';
INSERT INTO t1 VALUES (1), (2), (3), (4);
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 1
SET GLOBAL innodb_monitor_disable='module_buffer_page';
SET GLOBAL innodb_monitor_reset_all='module_buffer_page';
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 0
SET GLOBAL innodb_monitor_enable='%';
INSERT INTO t1 VALUES (5), (6), (7), (8);
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 1
SET GLOBAL innodb_monitor_disable='%';
SET GLOBAL innodb_monitor_reset_all='%';
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 0
SET GLOBAL innodb_monitor_enable='ALL';
INSERT INTO t1 VALUES (9), (10), (11), (12);
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0
buffer_page_written_index_leaf 1
DROP TABLE t1;
CREATE TABLE t1(id INT PRIMARY KEY, a INT, b CHAR(1), UNIQUE KEY u(a,b))
ENGINE=InnoDB;
SET @start = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
= 'lock_rec_lock_created');
BEGIN;
INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d');
DELETE FROM t1 WHERE a = 9999 AND b='b';
COMMIT;
SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
= 'lock_rec_lock_created');
SELECT @end - @start;
@end - @start
0
DROP TABLE t1;
SET GLOBAL innodb_monitor_enable=default;
SET GLOBAL innodb_monitor_disable=default;
SET GLOBAL innodb_monitor_reset_all=default;
|