[wp-trac] Re: [WordPress Trac] #5137: Taxonomy intersection queries are inefficient

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 5 07:48:15 GMT 2007


#5137: Taxonomy intersection queries are inefficient
----------------------------------+-----------------------------------------
 Reporter:  ryan                  |        Owner:  anonymous
     Type:  defect                |       Status:  reopened 
 Priority:  normal                |    Milestone:  2.3.1    
Component:  General               |      Version:  2.3      
 Severity:  normal                |   Resolution:           
 Keywords:  taxonomy performance  |  
----------------------------------+-----------------------------------------
Changes (by Otto42):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 As I pointed out, these won't work.

 {{{
 $tsql = "SELECT p.ID FROM ... blah ... ON (tt.term_id = t.term_id)";
 $tsql .= "WHERE tt.taxonomy = '$taxonomy' AND t.$taxonomy_field IN ('" .
 implode("', '", $q[$item]) . "')";
 $tsql .= "GROUP BY p.ID HAVING count(p.ID) = " . count($q[$item]);
 }}}

 You end up with no spaces between the ) and the WHERE or the ) and the
 GROUP. The query should fail unless MySQL is a lot smarter than any other
 database I've ever used.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5137#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list