[wp-hackers] Re: Very slow comment posting

Jamie intoxination at gmail.com
Fri May 9 12:45:15 GMT 2008



Robert R. Marsh, SJ wrote:
> That's the strange thing: (with caching disabled) the page takes ages to
> load after a comment (the footer comment shows about 50 queries and 50
> seconds!) has been made but NOT at other times.
>
> Rob
>
>   
That's an awful lot of queries. I would try to find out which query is 
causing the hangup. Put this in wp-config.php:

define('SAVEQUERIES', true);

And then in the footer put this:

<?
if (current_user_can('switch_themes')){
    global $wpdb;
    echo "<pre>";
    print_r($wpdb->queries);
    echo "</pre>";
}

That will show you each query, what function called it and how long that 
query took to execute. I just added the switch_themes permission so all 
the regular visitors don't get a large dump at the bottom of the page, 
so you need to be logged in as an admin, or change the permission to 
something lower.


More information about the wp-hackers mailing list