-1

My site keeps going down and the host says it's due to some slow queries overloading the server. They've supplied a list of slow queries, any pointers as to what I should be doing to get rid of or optimise them?

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
  • downvoted as it is too localized without seeing the code. It is obvious the DB options table is cluttered, and there are some bad queies being run, which together degrades performance, but there is nothing smarter that can be said here Mar 26, 2018 at 4:40

1 Answer 1

0

Perhaps info on this page might help: http://codex.wordpress.org/Class_Reference/wpdb

Other than that I would do the usual troubleshooting to start.

Backup everything.

Turn off all plugins.

Switch to a standard Wordpress theme like 2015.

Then see what errors you are getting now that you have stripped down your install.

Then slowly turn things back on until you isolate whatever is troublesome and get rid of it.

If you're convinced your code is sound look at a VPS, dedicated server, or a premium WordPress host as it could be a memory or resource issue you have run into.

You may also want to verify, your site isn't under attack or have some malicious code wreaking havoc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.