10.15.1 Typical Usage
MySQL 8.4 Reference Manual Including MySQL NDB Cluster 8.4
10.15.1 Typical Usage
To perform optimizer tracing entails the following steps:
- Enable tracing by executing
SEToptimizer_trace=“enabled=ON”. - Execute the statement to be traced. See Section 10.15.3, “Traceable Statements”, for a listing of statements which can be traced.
- Examine the contents of the
INFORMATION_SCHEMA.OPTIMIZER_TRACEtable. - To examine traces for multiple queries, repeat the previous two steps as needed.
- To disable tracing after you have finished, execute
SET optimizer_trace=“enabled=OFF”.
You can trace only statements which are executed within the current session; you cannot see traces from other sessions.
