[wp-trac] [WordPress Trac] #14405: New Conditional Template Tag: is_multi_author()

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 20 21:25:53 UTC 2010


#14405: New Conditional Template Tag: is_multi_author()
-------------------------+--------------------------------------------------
 Reporter:  iandstewart  |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:                 
 Severity:  normal       |    Keywords:                 
-------------------------+--------------------------------------------------

Comment(by westi):

 Replying to [comment:12 filosofo]:
 > Rather than
 > {{{
 > SELECT COUNT( DISTINCT post_author )  FROM $wpdb->posts
 > }}}
 > how about instead
 > {{{
 > SELECT DISTINCT post_author FROM $wpdb->posts ... LIMIT 2
 > }}}
 >
 > Since we only need 2 distinct authors to be multi-author, we can let the
 db engine stop once it's found 2 authors: it considers only the number of
 table rows it has to traverse to before finding 2 authors.  In contrast,
 the former query actually considers ''all'' rows, according to EXPLAIN
 results.
 >
 > Please see patch.

 Great thinking outside the box optimisation.

 Thank you!

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


More information about the wp-trac mailing list