Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I own a wordpress installation, and Updated to 3.4.1.

After the upgrade, I got a very strange slowdown to my wordpress.

After all, I used the

define('SAVEQUERIES', true);

in my wp-config.php with combined with the following code in my theme footer.php

global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";

and I found that while I don't have many queries (49 queries I got), there are

  • 4 Quiries took more than 9''
  • 3 Quiries took more than 8''
  • 4 Quiries took more than 7''
  • 4 Quiries took more than 6''
  • 8 Quiries took more than 5''
  • 1 Quiry took more than 4''

Here I will show you some of the queries:

/* Execution time 7.0095062E-5 */
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category') AND tt.count > 0 ORDER BY t.name ASC

/* Execution time 5.3167343E-5 */
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (77375,77379,77381)

/* Execution time 9.2029572E-5 */
SELECT wp_posts.* FROM wp_posts WHERE ID IN (77381,77379,77375)

In most of the queries there query is simple, with no complexity, and I cannot imagine why that queries are so slow.

The WordPress database contains in about 60.000 records and running on percona.

Any idea for that issue and how maybe can I fix it ?

share|improve this question
2  
Your queries are not slow. 9.2029572E-5 is less than .00009 seconds. Your problem is most likely theme or plugin related. Can you disable all plugins and switch to the default theme and see what the load time differences are? –  Chris_O Jul 20 '12 at 19:52

2 Answers 2

If you've got 60,000 records, try cleaning post/page revisions; these really accumulate and cause excessively long queries. I've seen database sizes drop 90% with huge increases in performance.

Run the query below in phpmyadmin or from the command line and then optimize:

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'

Talk to your web host, too. Maybe MySQL or your CPU is being throttled down.

share|improve this answer
    
The server is dedicated with 12GB of ram. Anyway that was a good option ;) –  Merianos Nikos Jul 20 '12 at 16:05
    
Lots of RAM is good, yes, but is percona configured to use it? Have you used tools.percona.com ? –  songdogtech Jul 20 '12 at 16:08

you are right ... there shouldn't be a problem with performance and your database my just need some improvements for caching.

Are you running W3 Total Cache - this should have an immediate benefit for your site performance and you'll want it to cache database if that is possible with your Server.

Then -- take a backup of your SQL database and you should also optimise & repair the tables.

share|improve this answer
    
I don't have installed the W3 Total Cache, but I use the APC. This is very helpfull for me. –  Merianos Nikos Jul 20 '12 at 15:49
1  
W3 Total Cache is no longer maintained and often causes more problems with APC and DB cache conflicts. wordpress.org/extend/plugins/wp-super-cache/is much more reliable. –  songdogtech Jul 20 '12 at 15:59
3  
@songdogtech you can't say that W3 Total Cache is not supported. It even has a commercial support option. From experience W3TC works well with Memcache, HyperDB and APC. –  Damien Jul 20 '12 at 17:05
2  
@Damien: I said "maintained", not "unsupported." The plugin has not been updated in almost a year and is not flagged compatible with 3.4.1. There may still be commercial support, yes, but that's not the point. Read wordpress.org/support/plugin/w3-total-cache Using a cache plugin for a database problem is just a bandaid. –  songdogtech Jul 20 '12 at 17:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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