performance_schema
Enable the Performance Schema instrumentation.
- 默认
ON- Range
- ON, OFF
- Restart needed
- 是
- Default checked on
- MySQL 8.4 LTS
作用
Provides statement digests, wait events, locks and memory instrumentation, and the sys schema views built on it.
默认值
ON. ON (MySQL 8.4).
Check the current value
SHOW GLOBAL VARIABLES LIKE 'performance_schema'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'performance_schema';
Change it
SET PERSIST_ONLY performance_schema = OFF; -- then restart mysqld (or set it under [mysqld] in my.cnf)
Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.
When to change it
Leave it on; individual instruments and consumers can be toggled at runtime in performance_schema.setup_instruments and setup_consumers.
What can go wrong
Turning it off saves some memory and CPU but removes most diagnostics.
Questions about performance_schema
What is the default value of performance_schema in MySQL?
ON. ON (MySQL 8.4).
Does changing performance_schema require a restart?
Yes. Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.
When should I change performance_schema?
Leave it on; individual instruments and consumers can be toggled at runtime in performance_schema.setup_instruments and setup_consumers.
Back to all MySQL settings, or check the MySQL manual for every option.
Related on SQLly
Check performance_schema on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.