Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

慢SQL查询 #19

Open
diaosichengxuyuan opened this issue Sep 6, 2020 · 0 comments
Open

慢SQL查询 #19

diaosichengxuyuan opened this issue Sep 6, 2020 · 0 comments

Comments

@diaosichengxuyuan
Copy link
Owner

diaosichengxuyuan commented Sep 6, 2020

1.slow_query_log
这个参数设置为ON,可以捕获执行时间超过一定数值的SQL语句。

2.long_query_time
当SQL语句执行时间超过此数值时,就会被记录到日志中,建议设置为1或者更短。

3.slow_query_log_file
记录日志的文件名。

4.log_queries_not_using_indexes
这个参数设置为ON,可以捕获到所有未使用索引的SQL语句,尽管这个SQL语句有可能执行得挺快。

mysql cpu 100%
show processlist查看正在执行的语句是否索引失效导致全表扫描
slow_query_log_file中查看是否有慢查询

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant