DennisCitus
06-15-2004, 05:43 AM
Hello,
My MySQL-Server seems to be getting very many slow-queries at some points. What could be causing this and how can I solve it?
The slow-query slow is always empty though. I am using /root/slowlog -> owned by mysql.mysql and chmod 777.
MySQL Log containing number of slow-queries:
http://www.fctwente.net/stats/mysql-status.txt
Server
Intel Pentium (4) 2.4ghz
1024mb memory
2x80gb hdd
Software
Red Hat Linux 9.0
PHP 4.3.6
MySQL 4.0.18
My.txt is /etc/my.cnf of course :)
hiryuu
06-15-2004, 05:56 AM
Yes, but /root/ is probably root-only (mode 700), so you probably want it in /var/log or something. The problem is usually non-indexed queries, but not always.
I would also suggest key_buffer=48M and delete myisam_sort_buffer_size (let it use the default). Since mysql is sharing resources with apache, you want to give the OS's cache some flexibility.
zupanm
06-15-2004, 07:11 AM
# slow query log
log-slow-queries
set-variable = long_query_time=1
you can just use that and that'll log in the standard /var/lib/mysql
it'll be called hostname-slow.log
DennisCitus
06-15-2004, 08:40 AM
This file hostname-slow.log will be generated when the first query passes the query-time of 1 second?
It's not generated by restarting MySQL.
My new my.cnf
[root@server02 mysql]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=512
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=48M
join_buffer=1M
max_allowed_packet=16M
table_cache=512
record_buffer=1M
sort_buffer_size=1M
read_buffer_size=1M
max_connect_errors=10
thread_concurrency=2
log-bin
server-id=1
log-slow-queries
long_query_time=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#safe-updates
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[mysqlhotcopy]
interactive-timeout
[root@server02 mysql]#
zupanm
06-15-2004, 08:48 AM
yes it'll be created at the first slow query