由于查询速度慢,网站正在关闭

时间:2015-07-18 作者:urok93

我的网站一直在宕机,主机说这是由于一些慢速查询导致服务器过载。他们提供了一个缓慢查询的列表,有没有关于我应该做些什么来消除或优化它们的指针?

Slow queries were found:
Executed 583 min ago for 3 sec on Database --> . 
DELETE FROM `wp_options` WHERE `option_name` = \'rewrite_rules 
Executed 548 min ago for 1 sec on Database --> . 
SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE \'\\\\_%\' ORDER BY meta_key LIMIT 30 
Executed 545 min ago for 1 sec on Database --> . 
SELECT DISTINCT meta_key FROM wp_postmeta ORDER BY meta_key LIMIT 1000 
Executed 539 min ago for 1 sec on Database --> . 
SELECT DISTINCT meta_key FROM wp_postmeta ORDER BY meta_key LIMIT 1000 
Executed 539 min ago for 1 sec on Database --> . 
SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE \'\\\\_%\' ORDER BY meta_key LIMIT 30 
Executed 490 min ago for 2 sec on Database --> . 
SELECT DISTINCT meta_key FROM wp_postmeta ORDER BY meta_key LIMIT 1000 
Executed 484 min ago for 1 sec on Database --> . 
SELECT DISTINCT meta_key FROM wp_postmeta ORDER BY meta_key LIMIT 1000 
Executed 484 min ago for 1 sec on Database --> . 
SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE \'\\\\_%\' ORDER BY meta_key LIMIT 30 
Executed 434 min ago for 4 sec on Database --> wp_wpdb_st1. 
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_parent = 0 AND wp_posts.post_type = \'edd_payment\' AND ((wp_posts.post_status = \'publish\' OR wp_posts.post_status = \'pending\' OR wp_posts.post_status = \'refunded\' OR wp_posts.post_status = \'failed\' OR wp_posts.post_status = \'revoked\' OR wp_posts.post_status = \'abandoned\')) ORDER BY wp_posts.ID DESC LIMIT 0, 30 
Executed 77 min ago for 1 sec on Database --> wp_wpdb. 
SELECT post_id, SLEEP(RAND()*0.20) AS junk FROM wp_postmeta WHERE meta_key = \'_edd_sl_key\' AND meta_value = \'1ad95d156f086772053a8acebd0270aa\' LIMIT 1 
Executed 77 min ago for 10 sec on Database --> wp_wpdb. 
SELECT post_id, SLEEP(RAND()*0.20) AS junk FROM wp_postmeta WHERE meta_key = \'_edd_sl_key\' AND meta_value = \'f3fe4e10fb2625f1faea3cc0b373dc66\' LIMIT 1 
Executed 77 min ago for 2 sec on Database --> wp_wpdb. 
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 (\'section\') AND tr.object_id IN (12060, 24940, 27706, 35346, 40867, 40977, 124168) ORDER BY t.name ASC 
Executed 77 min ago for 4 sec on Database --> wp_wpdb. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 77 min ago for 14 sec on Database --> wp_wpdb. 
SELECT post_modified_gmt FROM wp_posts WHERE post_status = \'publish\' AND post_type IN (\'post\', \'page\', \'attachment\', \'download\', \'thirstylink\', \'question\', \'testimonials\', \'wp_feed\', \'wp_feed_item\', \'wysijap\', \'docs\', \'websites\') ORDER BY post_modified_gmt DESC LIMIT 1 
Executed 77 min ago for 10 sec on Database --> wp_wpdb. 
SELECT post_id, SLEEP(RAND()*0.20) AS junk FROM wp_postmeta WHERE meta_key = \'_edd_sl_key\' AND meta_value = \'635c45fbc3de79dc952337873852a409\' LIMIT 1 
Executed 77 min ago for 25 sec on Database --> wp_wpdb. 
SELECT post_id, SLEEP(RAND()*0.20) AS junk FROM wp_postmeta WHERE meta_key = \'_edd_sl_key\' AND meta_value = \'8b9759fe31d19e37c1f589c52c0bd5c8\' LIMIT 1 
Executed 77 min ago for 18 sec on Database --> wp_wpdb. 
SELECT post_date_gmt FROM wp_posts WHERE post_status = \'publish\' AND post_type IN (\'post\', \'page\', \'attachment\', \'download\', \'thirstylink\', \'question\', \'testimonials\', \'wp_feed\', \'wp_feed_item\', \'wysijap\', \'docs\', \'websites\') ORDER BY post_date_gmt DESC LIMIT 1 
Executed 76 min ago for 3 sec on Database --> wp_wpdb. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 1 sec on Database --> wp_wpdb_st1. 
SHOW FULL COLUMNS FROM `wp_options 
Executed 76 min ago for 6 sec on Database --> wp_wpdb. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 4 sec on Database --> wp_wpdb. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 3 sec on Database --> wp_wpdb. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 1 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 1 sec on Database --> utf8. 
SELECT @@SESSION.sql_mode 
Executed 76 min ago for 6 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 2 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 1 sec on Database --> utf8. 
SELECT @@SESSION.sql_mode 
Executed 76 min ago for 6 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 1 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 2 sec on Database --> utf8. 
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes 
Executed 76 min ago for 2 sec on Database --> utf8. 
SELECT CURRENT_TIMESTAMP
Executed 76 min ago for 1 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 75 min ago for 4 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 75 min ago for 6 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 75 min ago for 4 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 75 min ago for 10 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 74 min ago for 1 sec on Database --> utf8.
SELECT @@SESSION.sql_mode
Executed 74 min ago for 7 sec on Database --> utf8.
SELECT post_id, SLEEP(RAND()*0.20) AS junk FROM wp_postmeta WHERE meta_key = \'_edd_sl_key\' AND meta_value = \'5fcc7aa22234df6b24f5e855afe90498\' LIMIT 1
Executed 74 min ago for 1 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 74 min ago for 5 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 74 min ago for 1 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 73 min ago for 4 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 73 min ago for 2 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 73 min ago for 4 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 73 min ago for 1 sec on Database --> utf8.
SELECT @@SESSION.sql_mode
Executed 73 min ago for 1 sec on Database --> utf8.
Init DB none - System Command
Executed 73 min ago for 1 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes
Executed 73 min ago for 1 sec on Database --> utf8.
SELECT option_name, option_value FROM wp_options WHERE autoload = \'yes

1 个回复
SO网友:Chrisdigital

此页上的信息可能会有所帮助:http://codex.wordpress.org/Class_Reference/wpdb

除此之外,我会做通常的故障排除开始。

备份所有内容。

关闭所有插件。

切换到标准Wordpress主题,如2015。

然后,查看您在剥离安装后遇到的错误。

然后慢慢地把事情重新打开,直到你隔离出任何麻烦并摆脱它。

如果您确信您的代码是可靠的,请查看VPS、专用服务器或高级WordPress主机,因为这可能是您遇到的内存或资源问题。

您可能还想验证您的站点是否受到攻击或是否有一些恶意代码造成严重破坏。

结束

相关推荐

$wpdb->GET_RESULTS返回空,但值存在

这是我的第一个问题。在Wordpress工作了5年多,我总是通过Google找到正确的方法,但在这种情况下,我甚至不知道该怎么办,我真的堆积了:(所以。。。我有MySQL表CREATE TABLE IF NOT EXISTS `statsdata` ( `id` int(11) NOT NULL AUTO_INCREMENT, `date` date NOT NULL, `sid` int(11) NOT NULL, `pid` int(11) NOT NU