MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

26.12.6.4 The prepared_statements_instances Table

The Performance Schema provides instrumentation for prepared statements, for which there are two protocols:

Performance Schema prepared statement instrumentation covers both protocols. The following discussion refers to the server commands rather than the C API functions or SQL statements.

Information about prepared statements is available in the prepared_statements_instances table. This table enables inspection of prepared statements used in the server and provides aggregated statistics about them. To control the size of this table, set the performance_schema_max_prepared_statements_instances system variable at server startup.

Collection of prepared statement information depends on the statement instruments shown in the following table. These instruments are enabled by default. To modify them, update the setup_instruments table.

Instrument Server Command
statement/com/Prepare COM_STMT_PREPARE
statement/com/Execute COM_STMT_EXECUTE
statement/sql/prepare_sql SQLCOM_PREPARE
statement/sql/execute_sql SQLCOM_EXECUTE

The Performance Schema manages the contents of the prepared_statements_instances table as follows:

The prepared_statements_instances table has these columns:

The prepared_statements_instances table has these indexes:

TRUNCATE TABLE resets the statistics columns of the prepared_statements_instances table.