Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter pragmatic

    (@pragmatic)

    I think I found the answer to this:
    Remove this line from you wp-config.php file if you have it:
    define('ENABLE_CACHE', true);

    This was a legacy setting left over from a previous version. We are happily back to 25 queries to generate a page.

    Hopefully someone can learn from my mistake.

    Thread Starter pragmatic

    (@pragmatic)

    I think I’ve tracked down where the query is coming from.

    In wp-includes\category.php Line 150:

    $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");

    Wrapped around this code is a call to check and see if it is in the cache. If it is, get it from cache, it it is not, get it from the database. However it appears it never finds it in the cache.

    I have the enable cache line in my wp-config.php file:
    define('ENABLE_CACHE', true);
    so that should be ok.

    It appears if the cache worked correctly then this wouldn’t be a problem.

    Anybody knows if there is a problem with the caching or if there is something special you need to do in order to get the cache to work?

    Thread Starter pragmatic

    (@pragmatic)

    Well, I been checking the mysql general log file and it appears most of the queries are either for options or for the categories. We have close to 200 categories and for some reason almost every category gets queried by id:

    SELECT * FROM wp_categories WHERE cat_ID = ‘125’ LIMIT 1

    And we’ll see hundreds of these on each page request.

    I’ve tried turning off all the plugins and that doesn’t seem to help. As mentioned previously, I’ve switched themes and it the problem got worse, not better.

    I’m still trying to figure out why WP needs to grab all the fields for each category.

    Thread Starter pragmatic

    (@pragmatic)

    Thanks for the reply Otto42. Can you tell me how many categories you have?

    I’ve noticed that wordpress does one seperate select statement for each category and I’m trying to figure out why.

    Thread Starter pragmatic

    (@pragmatic)

    For an example of a 2.05 blog: https://www.wealthyreader.com. It has 10 queries to bring back the main page. I realize it is a less populated blog but this demonstrates the type of performance we used to see on https://www.slipperybrick.com before we upgraded to 2.07 and then to 2.10.

Viewing 5 replies - 1 through 5 (of 5 total)