[wp-trac] [WordPress Trac] #10964: Improving query_posts performance

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 4 21:25:01 UTC 2011


#10964: Improving query_posts performance
-------------------------------------+-----------------------------
 Reporter:  buch0090                 |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Performance              |     Version:  2.8.4
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------

Comment (by scribu):

 If I understand this patch correctly, what it does is:

  1. Fetch *all* the post ids and then
  2. Fetch the rest of the rows using those IDs.

 This can cause segfaults if there are really many posts. If not all posts
 are fetched, then counting is off, so this approach doesn't seem too good.

 If SQL_CALC_FOUND_ROWS is the problem, then why not do this:

  1. Do the query, without SQL_CALC_FOUND_ROWS
  2. Do the query, with COUNT(*) and no limits, to get the total post
 count.

 This is how we handle term and comment count, and I've haven't heard any
 complaints.

 More importantly, this would be a lot easier on plugins.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10964#comment:77>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list