More efficient term intersection query. Props tigertech. see #16706

git-svn-id: http://svn.automattic.com/wordpress/trunk@17652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-04-18 20:38:59 +00:00
parent 03b604d309
commit 746bb77bf3
1 changed files with 4 additions and 4 deletions

View File

@ -694,12 +694,12 @@ class WP_Tax_Query {
$terms = implode( ',', $terms ); $terms = implode( ',', $terms );
$where[] = "$primary_table.$primary_id_column IN ( $where[] = "(
SELECT object_id SELECT COUNT(1)
FROM $wpdb->term_relationships FROM $wpdb->term_relationships
WHERE term_taxonomy_id IN ($terms) WHERE term_taxonomy_id IN ($terms)
GROUP BY object_id HAVING COUNT(object_id) = $num_terms AND object_id = $primary_table.$primary_id_column
)"; ) = $num_terms";
} }
$i++; $i++;