Blogger Information
Blog 12
fans 0
comment 0
visits 27649
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
mysql优化器追踪示例
小生我怕怕啊的博客
Original
716 people have browsed it


优化器追踪示例

查看优化器状态

show variables like 'optimizer_trace';

会话级别临时开启

set session optimizer_trace="enabled=on",end_markers_in_json=on;

设置优化器追踪的内存大小

set OPTIMIZER_TRACE_MAX_MEM_SIZE=1000000;

执行自己的SQL

select host,user,plugin from user;

information_schema.optimizer_trace表

SELECT trace FROM information_schema.OPTIMIZER_TRACE;

导入到一个命名为xx.trace的文件,然后用JSON阅读器来查看(如果没有控制台权限,或直接交由运维,让他把该 trace 文件,输出给你就行了。 )。

SELECT TRACE INTO DUMPFILE "E:\\test.trace" FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;

注意:不设置优化器最大容量的话,可能会导致优化器返回的结果不全




Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post