[wp-trac] [WordPress Trac] #14405: New Conditional Template Tag: is_multi_author()
WordPress Trac
wp-trac at lists.automattic.com
Wed Oct 20 16:06:39 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 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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14405#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list