Obtain the plan for a statement running in another session.
Section: explain and analysis
Explain a currently running connection
sql
sql
EXPLAIN FOR CONNECTION 12345;Explanation
Helpful during live troubleshooting when you have the blocking or long-running connection id.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing explain and analysis
Run EXPLAIN ANALYZE
Execute the query and include actual timing information.
Optimize a table
Reorganize table storage and update index statistics for supported engines.