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

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 17 18:15:50 UTC 2009


#10964: Improving query_posts performance
-------------------------+--------------------------------------------------
 Reporter:  buch0090     |       Owner:                          
     Type:  enhancement  |      Status:  new                     
 Priority:  normal       |   Milestone:  2.9                     
Component:  Performance  |     Version:  2.8.4                   
 Severity:  normal       |    Keywords:  query_posts, performance
-------------------------+--------------------------------------------------

Comment(by Denis-de-Bernardy):

 @Buch0090: Please try the attached patch. It:

  1. Implements your suggestion while ensuresing that pagination keeps
 working; and
  2. Maintains backward compatibility for plugins that use query-related
 hooks ([http://www.semiologic.com/software/opt-in-front/ example])

 @Ryan: I was initially leaning towards introducing new hooks, but backward
 compatibility considerations led me to rethink the whole idea and pass an
 extra argument instead: I'm added true for the quicker query that actually
 fetches rows, and false for the one that only fetches IDs. That way,
 plugins can potentially fetch if the second argument that gets passed is
 not empty and bail if they want.

 The order_by clause was left unchanged: if a plugin hooks into that, it
 might be that it's adding table joins or calculated fields with a having
 clause, and the order clause would end up the same in both queries. as for
 the limit clause, it's not needed for the quick query, so no point in
 filtering that one twice.

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


More information about the wp-trac mailing list