text mysql性能mysqldumpslow

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text mysql性能mysqldumpslow相关的知识,希望对你有一定的参考价值。

show variables;

-- set SESSION sort_buffer_size= 524288
-- select 512*1024  (256 262144)






mysqldumpslow — Summarize Slow Query Log Files

 SHOW VARIABLES LIKE '%log%';
 
 SET GLOBAL slow_query_log = 'ON';
 
 
 
 [mysqld]
# Set Slow Query Log
long_query_time = 1
slow_query_log = 1
slow_query_log_file = /usr/log/slowquery.log
log_queries_not_using_indexes = 1

#Set General Log
general_log = on
general_log_file=/usr/log/general.log

----------------------


If you use USE INDEX then you RECOMMEND optimizer to use this index, but it can use a table scan if optimizer thinks it will be faster. If you use FORCE INDEX then you MAKE optimizer to use this index even if it thinks a table scan is more efficient. Optimizer will use a table scan only if there is no way to use index to find rows.

Index Hint Syntax:

You can also use FORCE INDEX, which acts like USE INDEX (index_list) but with the addition that a table scan is assumed to be very expensive. In other words, a table scan is used only if there is no way to use one of the given indexes to find rows in the table.




Note that enabling general_log on a production server has overhead you should avoid it. You can check problematic queries from slow log.

以上是关于text mysql性能mysqldumpslow的主要内容,如果未能解决你的问题,请参考以下文章

《MySQL系列-InnoDB引擎15》慢查询日志拓展-mysqldumpslow日志分析工具

《MySQL系列-InnoDB引擎15》慢查询日志拓展-mysqldumpslow日志分析工具

mysql自带的slow_log分析工具mysqldumpslow

通过mysqldumpslow来分析日志

mysqldumpslow 分析slow query日志和explain分析mysql查询结构

mysql 开启慢查询及其用mysqldumpslow做日志分析