[wp-trac] [WordPress Trac] #21760: get_term_by() calls are not cached

WordPress Trac noreply at wordpress.org
Wed Sep 28 20:23:36 UTC 2016


#21760: get_term_by() calls are not cached
----------------------------------------+--------------------------
 Reporter:  wonderboymusic              |       Owner:  ocean90
     Type:  enhancement                 |      Status:  assigned
 Priority:  normal                      |   Milestone:  4.7
Component:  Taxonomy                    |     Version:  2.3
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  performance
----------------------------------------+--------------------------

Comment (by johnjamesjacoby):

 Replying to [comment:100 ocean90]:
 > Thanks @johnjamesjacoby, updated the overview. Going to work on some
 tests for that now.

 Thanks for doing the bulk of the work. :)

 A few things to add, in regards to @ocean90's query analysis:

 * `wp_terms.name` is indexed, so the additional `ORDER BY t.name` bit will
 not negatively impact performance, even though it's not necessary with a
 `LIMIT 1`
 * MySQL/MariaDB internally optimizes `tt.taxonomy IN ('category')` as
 `tt.taxonomy = 'category'`, so this change will not negatively impact
 performance either

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


More information about the wp-trac mailing list