这是一个创建于 3418 天前的主题,其中的信息可能已经有所发展或是发生改变。
wp程序,后台点击任意连接慢成狗,1万多点文章,下面是慢日志,大牛给讲讲咋优化下:
/usr/local/mysql/bin/mysqld, Version: 5.5.42-log (Source distribution). started with:
Tcp port: 3306 Unix socket: /tmp/mysql.sock
Time Id Command Argument
/usr/local/mysql/bin/mysqld, Version: 5.5.42-log (Source distribution). started with:
Tcp port: 3306 Unix socket: /tmp/mysql.sock
Time Id Command Argument
# Time: 150720 15:44:47
# User@Host: root[root] @ localhost []
# Query_time: 1.731746 Lock_time: 0.000108 Rows_sent: 1 Rows_examined: 23720
use database;
SET timestamp=1437378287;
SELECT * FROM wp_posts WHERE ID = 23731 LIMIT 1;
# Time: 150720 15:44:49
# User@Host: root[root] @ localhost []
# Query_time: 1.490322 Lock_time: 0.000096 Rows_sent: 5 Rows_examined: 27032
SET timestamp=1437378289;
SELECT wp_posts.* FROM wp_posts WHERE ID IN (27042,27040,27038,27036,27034);
# Time: 150720 15:44:51
# User@Host: root[root] @ localhost []
# Query_time: 1.680649 Lock_time: 0.000124 Rows_sent: 10 Rows_examined: 3076
SET timestamp=1437378291;
SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (27034, 27036, 27038, 27040, 27042) ORDER BY t.name ASC;
2 条回复 • 2015-07-20 18:38:37 +08:00
|
|
1
qinglangee 2015-07-20 18:35:13 +08:00
wp_posts 表上 id 没建索引吧,建个索引试试 CREATE INDEX wp_posts_id ON wp_posts (ID);
|
|
|
2
YAFEIML 2015-07-20 18:38:37 +08:00
|