[wp-trac] [WordPress Trac] #12891: Advanced multi-taxonomy WP_Query()s

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 16 20:47:53 UTC 2010


#12891: Advanced multi-taxonomy WP_Query()s
----------------------------+-----------------------------------------------
 Reporter:  markjaquith     |       Owner:  markjaquith    
     Type:  task (blessed)  |      Status:  assigned       
 Priority:  normal          |   Milestone:  3.1            
Component:  Query           |     Version:  3.0.1          
 Severity:  normal          |    Keywords:  ongoing-project
----------------------------+-----------------------------------------------

Comment(by ryan):

 In 3.1 this query takes 2,417.7ms.

 {{{
 SELECT SQL_CALC_FOUND_ROWS wp_3508545_posts.* FROM wp_3508545_posts WHERE
 1=1 AND wp_3508545_posts.ID IN (
 SELECT object_id
 FROM wp_3508545_term_relationships
 INNER JOIN wp_3508545_term_taxonomy USING (term_taxonomy_id)
 WHERE taxonomy IN ('category')
 AND term_id IN (14667805,14667940,14667953,14667963,34584120,1769037)
 ) AND wp_3508545_posts.post_type IN ('post', 'page', 'attachment') AND
 (wp_3508545_posts.post_status = 'publish' OR wp_3508545_posts.post_status
 = 'private') ORDER BY wp_3508545_posts.post_date DESC LIMIT 0, 6; SELECT
 FOUND_ROWS()
 }}}

 In 3.0 the analogous query takes 178.5ms:

 {{{
 SELECT SQL_CALC_FOUND_ROWS wp_3508545_posts.* FROM wp_3508545_posts INNER
 JOIN wp_3508545_term_relationships ON (wp_3508545_posts.ID =
 wp_3508545_term_relationships.object_id) INNER JOIN
 wp_3508545_term_taxonomy ON
 (wp_3508545_term_relationships.term_taxonomy_id =
 wp_3508545_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND
 wp_3508545_term_taxonomy.taxonomy = 'category' AND
 wp_3508545_term_taxonomy.term_id IN ('1769037', '14667805', '14667940',
 '14667953', '14667963', '34584120') AND wp_3508545_posts.post_type =
 'post' AND (wp_3508545_posts.post_status = 'publish' OR
 wp_3508545_posts.post_status = 'private') GROUP BY wp_3508545_posts.ID
 ORDER BY wp_3508545_posts.post_date DESC LIMIT 0, 6; SELECT FOUND_ROWS()
 }}}

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


More information about the wp-trac mailing list