content_image/770501.jpg content_image/770503.jpg
<img src='content_image/770501.jpg'>

mysql> SELECT * FROM performance_schema.setup_consumers WHERE NAME LIKE ’%statements%’; 

<img src='content_image/770503.jpg'>

To control statement event collection at server startup, use lines like these in your my.cnf  file: 

•Enable: 

[mysqld] performance-schema-instrument=’statement/%=ON’ performance-schema-consumer-events-statements-current=ON performance-schema-consumer-events-statements-history=ON performance-schema-consumer-events-statements-history-long=ON performance-schema-consumer-statements-digest=ON 

•Disable: 

[mysqld] performance-schema-instrument=’statement/%=OFF’ performance-schema-consumer-events-statements-current=OFF performance-schema-consumer-events-statements-history=OFF performance-schema-consumer-events-statements-history-long=OFF performance-schema-consumer-statements-digest=OFF 

To control statement event collection at runtime, update the setup_instruments  and setup_consumers  tables: 

•Enable: 

UPDATE performance_schema.setup_instruments SET ENABLED = ’YES’, TIMED = ’YES’ WHERE NAME LIKE ’statement/%’; UPDATE performance_schema.setup_consumers SET ENABLED = ’YES’ WHERE NAME LIKE ’%statements%’; 

•Disable: 

UPDATE performance_schema.setup_instruments SET ENABLED = ’NO’, TIMED = ’NO’ WHERE NAME LIKE ’statement/%’; UPDATE performance_schema.setup_consumers SET ENABLED = ’NO’ WHERE NAME LIKE ’%statements%’; 

To collect only specific statement events, enable only the corresponding statement instruments. To collect statement events only for specific statement event tables, enable the statement instruments but only the statement consumers corresponding to the desired tables. 

