Title: k-factor's Replies | WordPress.org

---

# k-factor

  [  ](https://wordpress.org/support/users/k-factor/)

 *   [Profile](https://wordpress.org/support/users/k-factor/)
 *   [Topics Started](https://wordpress.org/support/users/k-factor/topics/)
 *   [Replies Created](https://wordpress.org/support/users/k-factor/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/k-factor/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/k-factor/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/k-factor/engagements/)
 *   [Favorites](https://wordpress.org/support/users/k-factor/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Slow queries( SQL_CALC_FOUND_ROWS) bringing down site](https://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site/)
 *  [k-factor](https://wordpress.org/support/users/k-factor/)
 * (@k-factor)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site/#post-1754633)
 * 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.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Slow queries( SQL_CALC_FOUND_ROWS) bringing down site](https://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site/)
 *  [k-factor](https://wordpress.org/support/users/k-factor/)
 * (@k-factor)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site/#post-1754629)
 * 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.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Migrating a corporate site to WordPress… or not](https://wordpress.org/support/topic/migrating-a-corporate-site-to-wordpress-or-not/)
 *  Thread Starter [k-factor](https://wordpress.org/support/users/k-factor/)
 * (@k-factor)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/migrating-a-corporate-site-to-wordpress-or-not/#post-925200)
 * 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.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Migrating a corporate site to WordPress… or not](https://wordpress.org/support/topic/migrating-a-corporate-site-to-wordpress-or-not/)
 *  Thread Starter [k-factor](https://wordpress.org/support/users/k-factor/)
 * (@k-factor)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/migrating-a-corporate-site-to-wordpress-or-not/#post-924943)
 * Thanks for the tips! I appreciate any and all.

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