Home >Database >Mysql Tutorial >slow query log查询慢查询语句_MySQL

slow query log查询慢查询语句_MySQL

WBOY
WBOYOriginal
2016-06-01 13:41:271421browse

bitsCN.com
slow query log查询慢查询语句 Slow query log 慢查询日志,通过设置相关的慢查询参数,可以把数据库慢的sql语句输出到日志,这就是慢查询日志,很多情况下,考虑到性能问题,慢查询日志是不打开的,即不进行慢查询日志的输出,也许有时候为了查找慢查询语句,会临时打开,这是找寻低效率sql的一种方式,下面看一下参数  mysql>show variables like '%slow%';   +------------------+-------+ | Variable_name    | Value | +------------------+-------+ | log_slow_queries | OFF   | | slow_launch_time | 2     |   +------------------+-------+ 2 rows in set (0.00 sec) log_slow_queries 默认是关闭的,设置为 on则打开,有慢查询日志输出。Slow_launch_time设置慢查询标准,定义时间值,最小设置为1秒,查询时间超过这个值的将会输出到日志中。想找出1秒以下的慢查询标准,可以使用percona提供的microslow-patch来突破限制,将慢查询时间减小到毫秒级别。  作者 aeolus_pu bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn