30.1 Prerequisites for Using the sys Schema
MySQL 8.4 Reference Manual Including MySQL NDB Cluster 8.4
Before using the sys schema, the
prerequisites described in this section must be satisfied.
Because the sys schema provides an
alternative means of accessing the Performance Schema, the
Performance Schema must be enabled for the
sys schema to work. See
Section 29.3, “Performance Schema Startup Configuration”.
For full access to the sys schema, a
user must have these privileges:
SELECTon allsystables and viewsEXECUTEon allsysstored procedures and functionsINSERTandUPDATEfor thesys_configtable, if changes are to be made to it- Additional privileges for certain
sysschema stored procedures and functions, as noted in their descriptions (for example, theps_setup_save()procedure)
It is also necessary to have privileges for the objects underlying
the sys schema objects:
SELECTon any Performance Schema tables accessed bysysschema objects, andUPDATEfor any tables to be updated usingsysschema objectsPROCESSfor theINFORMATION_SCHEMAINNODB_BUFFER_PAGEtable
Certain Performance Schema instruments and consumers must be
enabled and (for instruments) timed to take full advantage of
sys schema capabilities:
- All
waitinstruments - All
stageinstruments - All
statementinstruments xxx_currentandxxx_history_longconsumers for all events
You can use the sys schema itself to
enable all of the additional instruments and consumers:
CALL sys.ps_setup_enable_instrument('wait');
CALL sys.ps_setup_enable_instrument('stage');
CALL sys.ps_setup_enable_instrument('statement');
CALL sys.ps_setup_enable_consumer('current');
CALL sys.ps_setup_enable_consumer('history_long');
Note
For many uses of the sys schema, the default
Performance Schema is sufficient for data collection. Enabling
all the instruments and consumers just mentioned has a
performance impact, so it is preferable to enable only the
additional configuration you need. Also, remember that if you
enable additional configuration, you can easily restore the
default configuration like this:
CALL sys.ps_setup_reset_to_default(TRUE);
