MySQL 5.7-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.

 

EXPLAIN FOR CONNECTION返回当前用于在给定连接中执行查询的EXPLAIN信息。由于数据(以及支持统计数据)的更改,在相同的查询文本上运行EXPLAIN可能会产生不同的结果。这种行为上的差异在诊断更多的瞬时性能问题时很有用。例如,如果在一个会话中运行一条语句,需要很长时间才能完成,那么在另一个会话中使用EXPLAIN For CONNECTION可能会产生有关延迟原因的有用信息。

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

connection_id是连接标识符,从INFORMATION_SCHEMA PROCESSLIST表或SHOW PROCESSLIST语句中获得。如果您拥有PROCESS特权,则可以为任何连接指定标识符。否则,只能为自己的连接指定标识符

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 SELECTDELETEINSERTREPLACE, and UPDATE. (However, EXPLAIN FOR CONNECTION does not work for prepared statements, even prepared statements of those types.)

如果指定连接没有执行语句,则结果为空。否则,只有当在命名连接中执行的语句是可解释的,EXPLAIN FOR CONNECTION才应用。这包括SELECT、DELETE、INSERT、REPLACE和UPDATE。(然而,EXPLAIN FOR CONNECTION不适用于预处理语句,即使是那些类型的预处理语句。)

If the named connection is executing an explainable statement, the output is what you would obtain by using EXPLAIN on the statement itself.

如果指定的连接正在执行一个可解释的语句,则输出是通过对语句本身使用EXPLAIN获得的。

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:

如果指定连接正在执行不可解释的语句,则会发生错误。例如,您不能为当前会话命名连接标识符,因为EXPLAIN是不可解释的:

The Com_explain_other status variable indicates the number of EXPLAIN FOR CONNECTION statements executed. 

Com_explain_other状态变量表示执行的EXPLAIN FOR CONNECTION语句的数量。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值