Documentation Home
MySQL 9.2 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 259.7Kb
Man Pages (Zip) - 366.9Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


29.4.4 Pre-Filtering by Instrument

Thesetup_instruments table lists the available instruments:

mysql> SELECT NAME, ENABLED, TIMED       FROM performance_schema.setup_instruments;+---------------------------------------------------+---------+-------+| NAME                                              | ENABLED | TIMED |+---------------------------------------------------+---------+-------+...| stage/sql/end                                     | NO      | NO    || stage/sql/executing                               | NO      | NO    || stage/sql/init                                    | NO      | NO    || stage/sql/insert                                  | NO      | NO    |...| statement/sql/load                                | YES     | YES   || statement/sql/grant                               | YES     | YES   || statement/sql/check                               | YES     | YES   || statement/sql/flush                               | YES     | YES   |...| wait/synch/mutex/sql/LOCK_global_read_lock        | YES     | YES   || wait/synch/mutex/sql/LOCK_global_system_variables | YES     | YES   || wait/synch/mutex/sql/LOCK_lock_db                 | YES     | YES   || wait/synch/mutex/sql/LOCK_manager                 | YES     | YES   |...| wait/synch/rwlock/sql/LOCK_grant                  | YES     | YES   || wait/synch/rwlock/sql/LOGGER::LOCK_logger         | YES     | YES   || wait/synch/rwlock/sql/LOCK_sys_init_connect       | YES     | YES   || wait/synch/rwlock/sql/LOCK_sys_init_slave         | YES     | YES   |...| wait/io/file/sql/binlog                           | YES     | YES   || wait/io/file/sql/binlog_index                     | YES     | YES   || wait/io/file/sql/casetest                         | YES     | YES   || wait/io/file/sql/dbopt                            | YES     | YES   |...

To control whether an instrument is enabled, set itsENABLED column toYES orNO. To configure whether to collect timing information for an enabled instrument, set itsTIMED value toYES orNO. Setting theTIMED column affects Performance Schema table contents as described inSection 29.4.1, “Performance Schema Event Timing”.

Modifications to mostsetup_instruments rows affect monitoring immediately. For some instruments, modifications are effective only at server startup; changing them at runtime has no effect. This affects primarily mutexes, conditions, and rwlocks in the server, although there may be other instruments for which this is true.

Thesetup_instruments table provides the most basic form of control over event production. To further refine event production based on the type of object or thread being monitored, other tables may be used as described inSection 29.4.3, “Event Pre-Filtering”.

The following examples demonstrate possible operations on thesetup_instruments table. These changes, like other pre-filtering operations, affect all users. Some of these queries use theLIKE operator and a pattern match instrument names. For additional information about specifying patterns to select instruments, seeSection 29.4.9, “Naming Instruments or Consumers for Filtering Operations”.

  • Disable all instruments:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = 'NO';

    Now no events are collected.

  • Disable all file instruments, adding them to the current set of disabled instruments:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = 'NO'WHERE NAME LIKE 'wait/io/file/%';
  • Disable only file instruments, enable all other instruments:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = IF(NAME LIKE 'wait/io/file/%', 'NO', 'YES');
  • Enable all but those instruments in themysys library:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = CASE WHEN NAME LIKE '%/mysys/%' THEN 'YES' ELSE 'NO' END;
  • Disable a specific instrument:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = 'NO'WHERE NAME = 'wait/synch/mutex/mysys/TMPDIR_mutex';
  • To toggle the state of an instrument,flip itsENABLED value:

    UPDATE performance_schema.setup_instrumentsSET ENABLED = IF(ENABLED = 'YES', 'NO', 'YES')WHERE NAME = 'wait/synch/mutex/mysys/TMPDIR_mutex';
  • Disable timing for all events:

    UPDATE performance_schema.setup_instrumentsSET TIMED = 'NO';