Rechercher dans le manuel MySQL
8.8.4 Obtaining Execution Plan Information for a Named Connection
To obtain the execution plan for an explainable statement executing in a named connection, use this statement:
EXPLAIN FOR CONNECTION
returns
the EXPLAIN
information that is
currently being used to execute a query in a given connection.
Because of changes to data (and supporting statistics) it may
produce a different result from running
EXPLAIN
on the equivalent query
text. This difference in behavior can be useful in diagnosing
more transient performance problems. For example, if you are
running a statement in one session that is taking a long time to
complete, using EXPLAIN FOR
CONNECTION
in another session may yield useful
information about the cause of the delay.
connection_id
is the connection
identifier, as obtained from the
INFORMATION_SCHEMA
PROCESSLIST
table or the
SHOW PROCESSLIST
statement. If
you have the PROCESS
privilege,
you can specify the identifier for any connection. Otherwise,
you can specify the identifier only for your own connections.
If the named connection is not executing a statement, the result
is empty. Otherwise, EXPLAIN FOR CONNECTION
applies only if the statement being executed in the named
connection is explainable. This includes
SELECT
,
DELETE
,
INSERT
,
REPLACE
, and
UPDATE
. (However,
EXPLAIN FOR CONNECTION
does not work for
prepared statements, even prepared statements of those types.)
If the named connection is executing an explainable statement,
the output is what you would obtain by using
EXPLAIN
on the statement itself.
If the named connection is executing a statement that is not
explainable, an error occurs. For example, you cannot name the
connection identifier for your current session because
EXPLAIN
is not explainable:
- +-----------------+
- +-----------------+
- | 373 |
- +-----------------+
The Com_explain_other
status variable
indicates the number of
EXPLAIN FOR
CONNECTION
statements executed.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-explain-for-connection.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.