More efficient term intersection query. Props tigertech. see #16706
git-svn-id: https://develop.svn.wordpress.org/trunk@17652 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
19eed5a750
commit
0f3921f771
|
@ -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++;
|
||||||
|
|
Loading…
Reference in New Issue