Wednesday, 25 July 2018

MySQL 5.7: Introduced EXPLAIN FOR CONNECTION to check the Execution Plan of Running Connections

In this post, I am sharing a new feature of MySQL 5.7 which is EXPLAIN FOR CONNECTION.
As we all aware about the EXPLAIN command of MySQL Server, which we are using to find a query execution information.
EXPLAIN FOR CONNECTION is a new feature and using this we can find query execution information about a running query connection.
When we are diagnosing performance problems, then this is very useful for us.
For example, We are running a statement in one session which is taking a long time, but using EXPLAIN FOR CONNECTION we can check the reason for the delay in another session.
We need to pass connection_id to check the running connection information.
We can check connection_id using different method like:
The syntax :
Once you execute above command and if result is empty, there are no any explainable statements. If we have SELECT, INSERT, UPDATE and DELETE, we can get execution information using this option.
For example:

0 comments:

Post a Comment