Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve rolled back to 3.02. After some more analysis I’m beginning to think that another problem may reside in category__and. And potentially aggravated by the fact that our site has so many categories. Running a sampling of our sql queries as generated by WP using category__and (feeding it two category IDs only), each query takes around 5 seconds to execute in the mysql workbench. Running these same queries against the pre-3.1 DB results in instant execution. Not sure what changed, but this has got to be a bug.

    I think I’m having this same issue on a less robust site. About 13,000 posts total, and a hundred or so categories. After the recent 3.1 upgrade, I instantly noticed a performance hit on two of our more query-intensive pages – pages that were quick-loading before, even without caching. Analyzing with query tools, it’s pretty clear that SQL_CALC_FOUND_ROWS is a culprit.

    One query that reads like this:

    $my_query1 = new WP_Query(array('category__and' => $myarray,'orderby' => title,'order' => ASC, 'post_status'=>publish, 'showposts' => 250,'ignore_sticky_posts' => 1));

    results in:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.*
    FROM wp_posts
    WHERE 1=1
    AND ( wp_posts.ID IN
    (
    SELECT object_id
    FROM wp_term_relationships
    WHERE term_taxonomy_id IN (3,6)
    GROUP BY object_id
    HAVING COUNT(object_id) = 2
    ))
    AND wp_posts.post_type = 'post'
    AND (wp_posts.post_status = 'publish')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_title ASC LIMIT 0, 250
    
    and:
    
    SELECT term_taxonomy_id
    FROM wp_term_taxonomy
    WHERE taxonomy = 'category'
    AND term_id IN (6,3)

    with a combined execute time of over 10 seconds.

    Once cached, of course the pages load quickly. But the CPU maxing out for one measley SQL query and one page-load is pretty ridiculous. Executed on their own in a query browser, the same queries are instantaneous, but obviously PHP and WordPress itself are involved in the mix here too.

    I’m at a loss for now. I’m by no means an expert PHP/MySQL/Wordpress coder, but I’ve lived and learned a bit. I would welcome any suggestions from anyone having better luck with this.

    Thread Starter k-factor

    (@k-factor)

    Thanks for the input here. The project is going pretty well so far. I’m getting speedier at writing PHP (coming from an ASP background), and custom page templates and custom fields are doing the trick so far. Some creative use of categories and subcategories has also produced some nice breakthroughs.

    I spent a lot of time researching data migration into WP. I even did a migration from my personal custom site to WP as a proof-of-concept. Unfortunately, it was not a very smooth process – definitely not clean enough for me to trust with the corporate site. The good news is my employer has a big budget and we’ll be hiring a temp or two to re-key a couple thousand records. Sometimes the safest solution is some good ol’ fat-fingering.

    Thread Starter k-factor

    (@k-factor)

    Thanks for the tips! I appreciate any and all.

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