最近,有时我无法打开我的网站。
我正在使用VPS进行托管。
当我做mytop时
它告诉我: User Host/IP DB Time Cmd Query or State
-- ---- ------- -- ---- --- ----------
12512 xxx localhost xxx 39 Query SELECT * FROM user WHERE no = '12341'
12513 xxx localhost xxx 39 Query SELECT name FROM user WHERE no = '2488'
12511 xxx localhost xxx 40 Query UPDATE `user` SET `exp` = exp+6, `vright` = vright+1, `correct` = correct+1 WHERE `name` = 'Amethys'
12465 xxx localhost xxx 48 Query SELECT * FROM user WHERE name = 'pinoysamurai'
12483 xxx localhost xxx 48 Query SELECT * FROM user WHERE name = 'pinoysamurai'
12501 xxx localhost xxx 52 Query UPDATE `user` SET `exp` = exp+7, `vright` = vright+1, `correct` = correct+1 WHERE `name` = 'yuya_sama'
12422 xxx localhost xxx 57 Query SELECT uo.name, ( SELECT COUNT(*) FROM user ui WHERE (ui.kright, ui.no) >= (uo.kright, uo.no) ) AS rank FROM user uo WHERE name = 0
最底层的查询需要100多秒才能完成。在它完成之前,它后面的队列也被卡住了。你可以在mytop输出上看到它。
这是什么问题? 我很沮丧......
我正在使用itk mpm 这是我的my.cnf文件:(我有512-1GB的RAM
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
old_passwords=1
interactive_timeout=27
wait_timeout=10
connect_timeout=10
skip-locking
skip-innodb
skip-bdb
max_connections=77
table_cache=2M
thread_cache_size=2M
query_cache_type=1
query_cache_limit=1M
query_cache_size=64M
key_buffer_size=64M
read_rnd_buffer_size=2M
read_buffer_size=2M
sort_buffer_size=2M
join_buffer_size=2M
thread_cache_size=128
thread_concurrency=12
thread_stack =256K
tmp_table_size=32M
谢谢,
答案 0 :(得分:0)
也许它有助于在kright, no
上添加组合索引,以便加入更快?但我不确定MySQL是否会尊重它。