I'm working on a larger WordPress site and trying to troubleshoot why my site is so slow. I've installed W3 Total Cache and have run multiple page speed and plugin tests with no luck.

What's strange is that my pages load within 2 - 3 seconds but the initial server connection ("waiting for server") takes about 10 - 15 seconds.

I looked into /var/log/mysqlslow.log and found massive queries like this one:

# Time: 131107 16:47:15
# User@Host: username/pw @ localhost []
# Query_time: 13.970453  Lock_time: 0.310980 Rows_sent: 3  Rows_examined: 16925
SET timestamp=1383871635;
SELECT distinct ID FROM wp_posts  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE post_type = 'post' AND post_status = 'publish' AND ID<>1000040979 AND ID IN ('30460', '49942', ...

The IDs in parenthesis go on for pages and pages. They are incredibly long. Does anyone have a clue what's happening here and why these queries are so long?

  • Turn on debugging (SAVEQUERIES) and look at the queries, codex.wordpress.org/Debugging_in_WordPress – Wyck Nov 19 '13 at 16:54
  • Did you test the default theme? Do you have a page with lots of posts? Try the debug plugins to locate the query in your code. This looks strange: ID<>1000040979 (i.e. very high index) – birgire Nov 20 '13 at 8:56

Your Answer

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

Browse other questions tagged or ask your own question.