Trace analyzer execution plan
mysql5.6 provides a trace of sql. In order to see through the trace, we can further understand why the optimizer chooses plan A instead of plan B. Open the trace, set the format of json, and set the maximum memory size that the trace can use to avoid During the parsing process, the default memory size cannot be displayed completely.
set optimizer_trace="enabled=on",end_markers_in_json=on;
set optimizer_trace_max_mem_size=1000000
Execute sql statement
select * from article where id <4
Finally, check information_schema.optimizer_trace to know how to execute mysql
select * from information_schema.optimizer_trace