Rechercher dans le manuel MySQL
26.12.17.3 Statement Summary Tables
The Performance Schema maintains tables for collecting current and recent statement events, and aggregates that information in summary tables. Section 26.12.6, “Performance Schema Statement Event Tables” describes the events on which statement summaries are based. See that discussion for information about the content of statement events, the current and historical statement event tables, and how to control statement event collection, which is partially disabled by default.
Example statement event summary information:
- FROM performance_schema.events_statements_summary_global_by_event_name\G
- *************************** 1. row ***************************
- COUNT_STAR: 25
- SUM_TIMER_WAIT: 1535983999000
- MIN_TIMER_WAIT: 209823000
- AVG_TIMER_WAIT: 61439359000
- MAX_TIMER_WAIT: 1363397650000
- SUM_LOCK_TIME: 20186000000
- SUM_ERRORS: 0
- SUM_WARNINGS: 0
- SUM_ROWS_AFFECTED: 0
- SUM_ROWS_SENT: 388
- SUM_ROWS_EXAMINED: 370
- SUM_CREATED_TMP_DISK_TABLES: 0
- SUM_CREATED_TMP_TABLES: 0
- SUM_SELECT_FULL_JOIN: 0
- SUM_SELECT_FULL_RANGE_JOIN: 0
- SUM_SELECT_RANGE: 0
- SUM_SELECT_RANGE_CHECK: 0
- SUM_SELECT_SCAN: 6
- SUM_SORT_MERGE_PASSES: 0
- SUM_SORT_RANGE: 0
- SUM_SORT_ROWS: 0
- SUM_SORT_SCAN: 0
- SUM_NO_INDEX_USED: 6
- SUM_NO_GOOD_INDEX_USED: 0
- ...
Each statement summary table has one or more grouping columns
to indicate how the table aggregates events. Event names refer
to names of event instruments in the
setup_instruments
table:
events_statements_summary_by_account_by_event_name
hasEVENT_NAME
,USER
, andHOST
columns. Each row summarizes events for a given account (user and host combination) and event name.events_statements_summary_by_digest
hasSCHEMA_NAME
andDIGEST
columns. Each row summarizes events per schema and digest value. (TheDIGEST_TEXT
column contains the corresponding normalized statement digest text, but is neither a grouping nor a summary column. TheQUERY_SAMPLE_TEXT
,QUERY_SAMPLE_SEEN
, andQUERY_SAMPLE_TIMER_WAIT
columns also are neither grouping nor summary columns; they support statement sampling.)The maximum number of rows in the table is autosized at server startup. To set this maximum explicitly, set the
performance_schema_digests_size
system variable at server startup.events_statements_summary_by_host_by_event_name
hasEVENT_NAME
andHOST
columns. Each row summarizes events for a given host and event name.events_statements_summary_by_program
hasOBJECT_TYPE
,OBJECT_SCHEMA
, andOBJECT_NAME
columns. Each row summarizes events for a given stored program (stored procedure or function, trigger, or event).events_statements_summary_by_thread_by_event_name
hasTHREAD_ID
andEVENT_NAME
columns. Each row summarizes events for a given thread and event name.events_statements_summary_by_user_by_event_name
hasEVENT_NAME
andUSER
columns. Each row summarizes events for a given user and event name.events_statements_summary_global_by_event_name
has anEVENT_NAME
column. Each row summarizes events for a given event name.prepared_statements_instances
has anOBJECT_INSTANCE_BEGIN
column. Each row summarizes events for a given prepared statement.
Each statement summary table has these summary columns containing aggregated values (with exceptions as noted):
COUNT_STAR
,SUM_TIMER_WAIT
,MIN_TIMER_WAIT
,AVG_TIMER_WAIT
,MAX_TIMER_WAIT
These columns are analogous to the columns of the same names in the wait event summary tables (see Section 26.12.17.1, “Wait Event Summary Tables”), except that the statement summary tables aggregate events from
events_statements_current
rather thanevents_waits_current
.The
prepared_statements_instances
table does not have these columns.SUM_
xxx
The aggregate of the corresponding
xxx
column in theevents_statements_current
table. For example, theSUM_LOCK_TIME
andSUM_ERRORS
columns in statement summary tables are the aggregates of theLOCK_TIME
andERRORS
columns inevents_statements_current
table.
The
events_statements_summary_by_digest
table has these additional summary columns:
FIRST_SEEN
,LAST_SEEN
Timestamps indicating when statements with the given digest value were first seen and most recently seen.
QUANTILE_95
: The 95th percentile of the statement latency, in picoseconds. This percentile is a high estimate, computed from the histogram data collected. In other words, for a given digest, 95% of the statements measured have a latency lower thanQUANTILE_95
.For access to the histogram data, use the tables described in Section 26.12.17.4, “Statement Histogram Summary Tables”.
QUANTILE_99
: Similar toQUANTILE_95
, but for the 99th percentile.QUANTILE_999
: Similar toQUANTILE_95
, but for the 99.9th percentile.
The
events_statements_summary_by_digest
table contains the following columns. These are neither
grouping nor summary columns; they support statement sampling:
QUERY_SAMPLE_TEXT
A sample SQL statement that produces the digest value in the row. This column enables applications to access, for a given digest value, a statement actually seen by the server that produces that digest. One use for this might be to run
EXPLAIN
on the statement to examine the execution plan for a representative statement associated with a frequently occurring digest.When the
QUERY_SAMPLE_TEXT
column is assigned a value, theQUERY_SAMPLE_SEEN
andQUERY_SAMPLE_TIMER_WAIT
columns are assigned values as well.The maximum space available for statement display is 1024 bytes by default. To change this value, set the
performance_schema_max_sql_text_length
system variable at server startup. (Changing this value affects columns in other Performance Schema tables as well. See Section 26.10, “Performance Schema Statement Digests and Sampling”.)For information about statement sampling, see Section 26.10, “Performance Schema Statement Digests and Sampling”.
QUERY_SAMPLE_SEEN
A timestamp indicating when the statement in the
QUERY_SAMPLE_TEXT
column was seen.QUERY_SAMPLE_TIMER_WAIT
The wait time for the sample statement in the
QUERY_SAMPLE_TEXT
column.
The
events_statements_summary_by_program
table has these additional summary columns:
COUNT_STATEMENTS
,SUM_STATEMENTS_WAIT
,MIN_STATEMENTS_WAIT
,AVG_STATEMENTS_WAIT
,MAX_STATEMENTS_WAIT
Statistics about nested statements invoked during stored program execution.
The prepared_statements_instances
table has these additional summary columns:
COUNT_EXECUTE
,SUM_TIMER_EXECUTE
,MIN_TIMER_EXECUTE
,AVG_TIMER_EXECUTE
,MAX_TIMER_EXECUTE
Aggregated statistics for executions of the prepared statement.
The statement summary tables have these indexes:
events_transactions_summary_by_account_by_event_name
:Primary key on (
USER
,HOST
,EVENT_NAME
)
events_statements_summary_by_digest
:Primary key on (
SCHEMA_NAME
,DIGEST
)
events_transactions_summary_by_host_by_event_name
:Primary key on (
HOST
,EVENT_NAME
)
events_statements_summary_by_program
:Primary key on (
OBJECT_TYPE
,OBJECT_SCHEMA
,OBJECT_NAME
)
events_statements_summary_by_thread_by_event_name
:Primary key on (
THREAD_ID
,EVENT_NAME
)
events_transactions_summary_by_user_by_event_name
:Primary key on (
USER
,EVENT_NAME
)
events_statements_summary_global_by_event_name
:Primary key on (
EVENT_NAME
)
TRUNCATE TABLE
is permitted for
statement summary tables. It has these effects:
For
events_statements_summary_by_digest
, it removes the rows.For other summary tables not aggregated by account, host, or user, truncation resets the summary columns to zero rather than removing rows.
For other summary tables aggregated by account, host, or user, truncation removes rows for accounts, hosts, or users with no connections, and resets the summary columns to zero for the remaining rows.
In addition, each statement summary table that is aggregated
by account, host, user, or thread is implicitly truncated by
truncation of the connection table on which it depends, or
truncation of
events_statements_summary_global_by_event_name
.
For details, see
Section 26.12.8, “Performance Schema Connection Tables”.
In addition, truncating
events_statements_summary_by_digest
implicitly truncates
events_statements_histogram_by_digest
,
and truncating
events_statements_summary_global_by_event_name
implicitly truncates
events_statements_histogram_global
.
Statement Digest Aggregation Rules
If the statements_digest
consumer is
enabled, aggregation into
events_statements_summary_by_digest
occurs as follows when a statement completes. Aggregation is
based on the DIGEST
value computed for
the statement.
If a
events_statements_summary_by_digest
row already exists with the digest value for the statement that just completed, statistics for the statement are aggregated to that row. TheLAST_SEEN
column is updated to the current time.If no row has the digest value for the statement that just completed, and the table is not full, a new row is created for the statement. The
FIRST_SEEN
andLAST_SEEN
columns are initialized with the current time.If no row has the statement digest value for the statement that just completed, and the table is full, the statistics for the statement that just completed are added to a special “catch-all” row with
DIGEST
=NULL
, which is created if necessary. If the row is created, theFIRST_SEEN
andLAST_SEEN
columns are initialized with the current time. Otherwise, theLAST_SEEN
column is updated with the current time.
The row with DIGEST
=
NULL
is maintained because Performance
Schema tables have a maximum size due to memory constraints.
The DIGEST
= NULL
row
permits digests that do not match other rows to be counted
even if the summary table is full, using a common
“other” bucket. This row helps you estimate
whether the digest summary is representative:
A
DIGEST
=NULL
row that has aCOUNT_STAR
value that represents 5% of all digests shows that the digest summary table is very representative; the other rows cover 95% of the statements seen.A
DIGEST
=NULL
row that has aCOUNT_STAR
value that represents 50% of all digests shows that the digest summary table is not very representative; the other rows cover only half the statements seen. Most likely the DBA should increase the maximum table size so that more of the rows counted in theDIGEST
=NULL
row would be counted using more specific rows instead. To do this, set theperformance_schema_digests_size
system variable to a larger value at server startup. The default size is 200.
For stored program types for which instrumentation is
enabled in the setup_objects
table,
events_statements_summary_by_program
maintains statistics for stored programs as follows:
A row is added for an object when it is first used in the server.
The row for an object is removed when the object is dropped.
Statistics are aggregated in the row for an object as it executes.
See also Section 26.4.3, “Event Pre-Filtering”.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-statement-summary-tables.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.