[wp-trac] [WordPress Trac] #41796: WP_Term_Query problem using object_ids and number attributes

WordPress Trac noreply at wordpress.org
Thu Sep 14 22:28:44 UTC 2017


#41796: WP_Term_Query problem using object_ids and number attributes
-------------------------------------+---------------------------
 Reporter:  elvishp2006              |       Owner:  boonebgorges
     Type:  defect (bug)             |      Status:  closed
 Priority:  normal                   |   Milestone:  4.9
Component:  Taxonomy                 |     Version:  4.8.1
 Severity:  normal                   |  Resolution:  fixed
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------------

Comment (by Otto42):

 Just a note that this change appears to have broken the "tag cloud" on the
 WordPress.org support forums. We had to disable them because the queries
 generated with this new DISTINCT in place were running too long.

 https://meta.trac.wordpress.org/changeset/5927

 For reference, the taxonomy involved here is "topic-tag" which is used for
 the support forum topics in bbPress. The terms table and term_taxonomy
 table each contain approximately 500000 entries.

 The resulting query looks like the following:

 {{{
 SELECT DISTINCT t.*, tt.* FROM wp_terms AS t
 INNER JOIN wp_term_taxonomy AS tt
 ON t.term_id = tt.term_id
 WHERE tt.taxonomy IN ('topic-tag')
 AND tt.count > 0
 ORDER BY tt.count DESC
 LIMIT 22
 }}}

 Remove the DISTINCT keyword and the query runs more or less fine.

 So, systems with lots of terms may be negatively impacted, possibly
 broken, by this change. Might want to rethink it, and test on large
 installations.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41796#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list