本来我想记录慢查询:
【my.cnf】
slow_query_log = /var/lib/mysql/slowquery.log ##慢查询日志文件
long_query_time = 3 ###慢查询时间
log-queries-not-using-indexes
[Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-sl ave-statements have no effect if --log_slow_queries is not set重启有这个警告
意思是 log_slow_queries 这个没设置 索引的就没作用:
然后我设置log_slow_queries
重启;
[Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.又说 log_slow_queries 过时了!!现在该怎么正确的设置呢?
我想的到超过3秒的记录下sql语句 或者 没有索引的查询也记录下来!
【my.cnf】
slow_query_log = /var/lib/mysql/slowquery.log ##慢查询日志文件
long_query_time = 3 ###慢查询时间
log-queries-not-using-indexes
[Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-sl ave-statements have no effect if --log_slow_queries is not set重启有这个警告
意思是 log_slow_queries 这个没设置 索引的就没作用:
然后我设置log_slow_queries
重启;
[Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.又说 log_slow_queries 过时了!!现在该怎么正确的设置呢?
我想的到超过3秒的记录下sql语句 或者 没有索引的查询也记录下来!
解决方案 »
- MYSQL无法提交
- 怎样在程序中得知存储过程发生了回滚?
- Commands out of sync; you can't run this command now?
- 数据库新手请教这样的数据库如何设计
- 数据库同步 指定表,指定字段
- 弱弱的的问:大家为什么选择mysql?
- mysql的表里有没有一个相当于foxpro中记录号的东西?
- 求救:怎么我在Redhat9.0下无法启动mysql呀!!!
- 我在一台电脑上装上SQL SERVER 2000 的客户端,如何连上我所在局域网中的SQL SERVER 2000 服务器,
- porsql?
- 条件update,谢谢啦
- 1135Can't create a new thread (errno 12)
只需要set global slow_query_log=on;就可以了
我是直接编辑的my.cnf 这也是一样的撒 然后我还想记录没有索引的查询 不是要用到这个参数吗? log-queries-not-using-indexes
只启用slow_query_log=on就可以了。
--slow_query_log
--slow_query_log_file
正确的用法是:
slow_query_log
slow_query_log_file=/var/lib/mysql/slowquery.log
log-queries-not-using-indexes其中log-queries-not-using-indexes会记录所有没有用上索引全表扫描的语句,就算你的SQL没有超过long_query_time设置的时间。有些只有一二十条记录的表全表扫描并不是什么大事也会记录到你的慢查日志中,对慢查分析有一定的坏处,你需要斟酌加上这个参数。