Spec-Zone .ru
спецификации, руководства, описания, API

21.9.5. Performance Schema Statement Event Tables

21.9.5.1. The events_statements_current Table
21.9.5.2. The events_statements_history Table
21.9.5.3. The events_statements_history_long Table

As of MySQL 5.6.3, the Performance Schema instruments statement execution. Statement events occur at a high level of the event hierarchy. Wait events nest within stage events, which nest within statement events.

These tables store statement events:

Statement monitoring begins from the moment when the server sees that activity is requested on a thread, to the moment when all activity has ceased. Typically, this means from the time the server gets the first packet from the client to the time the server has finished sending the response. Monitoring occurs only for top-level statements. Statements within stored programs and subqueries are not seen separately.

A request from a client can be either a command or a SQL statement:

There are also special error-handling instruments:

Details for a request are not initially known. For example, because a SQL statement is sent as text inside a COM_QUERY packet, the proper statement/sql/* instrument is not known at the moment the request is received. The Performance Schema at first instruments such a request using an event with an EVENT_NAME of statement/com/Query. Then it changes the EVENT_NAME value to either a valid statement/sql/* name if the statement parses, or to statement/sql/error if it does not.