网站建设一般满足什么需求,网站建设公司网站建设专业品牌,杭州专业程序开发公司,商务网站建设与维护考试optimizer_trace 它可以跟踪优化器做出的各种决策#xff08;比如访问表的方法、各种开销计算、各种转换等#xff09;#xff0c;并将跟踪结果记录到 information_schema 数据库中的 optimizer_trace 表中。 mysql 默认是关闭 追踪的 开启、并设置格式为 josn,同时设置trac…optimizer_trace 它可以跟踪优化器做出的各种决策比如访问表的方法、各种开销计算、各种转换等并将跟踪结果记录到 information_schema 数据库中的 optimizer_trace 表中。 mysql 默认是关闭 追踪的 开启、并设置格式为 josn,同时设置trace最大能够使用的内存大小避免解析过程中因默认内存过小而不能完整展示 set optimizer_trace“enabledon”,end_markers_in_jsonon; set optimizer_trace_max_mem_size100000; 开启后可分析如下语句 select insert replace update delete explain set declare case if return call Sys schema 视图摘要
主机相关以host_summary 开头主要汇总了IO延迟的信息InnoDB 相关以innodb开头汇总了innodb buffer 信息和事务等待innodb锁的信息I/O相关以io开头汇总了等待I/O、I/O 使用量情况内存使用情况以memory开头从主机、线程、事件等角度展示内存的使用情况连接与会话信息processlist和session相关视图总结了会话相关信息表相关以schema_table 开头的视图展示了表的统计信息索引信息统计了索引的使用情况包含冗余索引和未使用的索引情况语句相关以statement开头包含执行全表扫描、使用临时表、排序的语句信息。用户相关以user开头的视图统计了用户使用的文件I/O、执行语句统计信息。 10.等待事件相关信息以wait开头展示等待事件的延迟情况。
索引情况 查询冗余索引 select * from sys.schema_redundant_indexes; 查询未使用过的索引 select * from sys。schema_unused_indexes; 查询索引的使用情况 select index_name,rows_selected,rows_inserted,rows_updated,rows_deleted from sys.schema_index_statistics where table_name‘xxx’; 表相关 查询表的访问量 select table_schema,table_name,sum(io_read_requestsio_write_requests) as io from sys.schema_table_statistics group by table_schema,table_name order by io desc; 查询占用 bufferpool较多的表 select object_schema,object_name,allocated data from sys,innodb_buffer_stats_by_table group by object_schema,object_name order by allocated limit 10; 查看表的全表扫描情况 select * from sys。statements_with_full_table_scans where db‘xxx’;