Rechercher dans le manuel MySQL
27.4.4.22 The ps_trace_statement_digest() Procedure
Traces all Performance Schema instrumentation for a specific statement digest.
If you find a statement of interest within the Performance
Schema
events_statements_summary_by_digest
table, specify its DIGEST
column MD5 value
to this procedure and indicate the polling duration and
interval. The result is a report of all statistics tracked
within Performance Schema for that digest for the interval.
The procedure also attempts to execute
EXPLAIN
for the longest running
example of the digest during the interval. This attempt might
fail because the Performance Schema truncates long
SQL_TEXT
values. Consequently,
EXPLAIN
will fail due to parse
errors.
This procedure disables binary logging during its execution by
manipulating the session value of the
sql_log_bin
system variable.
That is a restricted operation, so the procedure requires
privileges sufficient to set restricted session variables. See
Section 5.1.9.1, “System Variable Privileges”.
Parameters
in_digest VARCHAR(32)
: The statement digest identifier to analyze.in_runtime INT
: How long to run the analysis in seconds.in_interval DECIMAL(2,2)
: The analysis interval in seconds (which can be fractional) at which to try to take snapshots.in_start_fresh BOOLEAN
: Whether to truncate the Performance Schemaevents_statements_history_long
andevents_stages_history_long
tables before starting.in_auto_enable BOOLEAN
: Whether to automatically enable required consumers.
- +--------------------+
- | SUMMARY STATISTICS |
- +--------------------+
- | SUMMARY STATISTICS |
- +--------------------+
- +------------+-----------+-----------+-----------+---------------+------------+------------+
- | executions | exec_time | lock_time | rows_sent | rows_examined | tmp_tables | full_scans |
- +------------+-----------+-----------+-----------+---------------+------------+------------+
- | 21 | 4.11 ms | 2.00 ms | 0 | 21 | 0 | 0 |
- +------------+-----------+-----------+-----------+---------------+------------+------------+
- +------------------------------------------+-------+-----------+
- +------------------------------------------+-------+-----------+
- | stage/sql/statistics | 16 | 546.92 us |
- | stage/sql/freeing items | 18 | 520.11 us |
- | stage/sql/init | 51 | 466.80 us |
- ...
- | stage/sql/cleaning up | 18 | 11.92 us |
- | stage/sql/executing | 16 | 6.95 us |
- +------------------------------------------+-------+-----------+
- +---------------------------+
- | LONGEST RUNNING STATEMENT |
- +---------------------------+
- | LONGEST RUNNING STATEMENT |
- +---------------------------+
- +-----------+-----------+-----------+-----------+---------------+------------+-----------+
- | thread_id | exec_time | lock_time | rows_sent | rows_examined | tmp_tables | full_scan |
- +-----------+-----------+-----------+-----------+---------------+------------+-----------+
- | 166646 | 618.43 us | 1.00 ms | 0 | 1 | 0 | 0 |
- +-----------+-----------+-----------+-----------+---------------+------------+-----------+
- # Truncated for clarity...
- +-----------------------------------------------------------------+
- | sql_text |
- +-----------------------------------------------------------------+
- +-----------------------------------------------------------------+
- +------------------------------------------+-----------+
- | event_name | latency |
- +------------------------------------------+-----------+
- | stage/sql/init | 8.61 us |
- | stage/sql/init | 331.07 ns |
- ...
- | stage/sql/freeing items | 30.46 us |
- | stage/sql/cleaning up | 662.13 ns |
- +------------------------------------------+-----------+
- +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+
- +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+
- +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+
- Query OK, 0 rows affected (9.28 sec)
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-sys-ps-trace-statement-digest.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.