1

I often began to fall down mysql. I recorded a large number of requests:

| 243751 | user | localhost | database | Query | 985 | Sending data | SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes' |

How to identify the problem and fix it?

2

MySQL shouldn't crash because of queries like those, but it could feel like it does because your site won't work.

I'd first run

SELECT option_name, length(option_value) FROM wp_options WHERE autoload = 'yes' ORDER BY length(option_value) DESC;

to see if some option has accumulated a large value (I've seen wp-cron entries grow very large in one release ~2 years back).

Also check how many options will be automatically loaded:

SELECT count(*) FROM wp_options WHERE autoload = 'yes';

Those are usually a few hundred, if it's a very large number, investigate further.

If both these queries don't show anything weird, you may want to look into MySQL itself. Is the RAM on your machine exhausted and (slow) SWAP is being used? Is there a faulty hard disk and re-reads are timing out?

  • The first request was issued by: joxi.ru/a2XzXPlTykoblr . the second request issued the following quantity: 26056. Memory on the server is used only 5 percent of the total – Marat Petrov Dec 23 '17 at 21:11
  • 26k options looks like a lot. Maybe output the results for SELECT option_name FROM wp_options WHERE autoload = 'yes' ORDER BY option_name; and scroll through that list. I'm pretty sure you will find patterns. Maybe you're using transients heavily? If you find lots of options with names that start with _transient_ or _site_transient_, those might be the problem. They're usually safe to delete (but make sure you have a backup in any case before performing database operations). – janh Dec 23 '17 at 21:24
  • Records found a lot, but the question, but _transient_ no. What to do in this case? – Marat Petrov Dec 24 '17 at 8:08
  • Look for similar records and figure out where they're coming from. Since the list is ordered, you should be able to quickly scroll through it and see parts of the names being repeated. – janh Dec 24 '17 at 8:21
  • Thank you. I found many records of this type: _transient_0508d1455aa8d2a05e684f5f7e4c1a8a. I will delete – Marat Petrov Dec 24 '17 at 9:20

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.