[wp-trac] [WordPress Trac] #40351: Term post re-counts scale poorly, are common and difficult to avoid
WordPress Trac
noreply at wordpress.org
Wed Oct 14 00:50:08 UTC 2020
#40351: Term post re-counts scale poorly, are common and difficult to avoid
-------------------------------------------------+-------------------------
Reporter: mattoperry | Owner: whyisjake
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.6
Component: Taxonomy | Version: 4.8
Severity: normal | Resolution: fixed
Keywords: has-patch needs-testing early | Focuses:
needs-dev-note has-unit-tests dev-feedback | performance
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"49141" 49141]:
{{{
#!CommitTicketReference repository="" revision="49141"
Taxonomy: Improve performance of term recounting database queries.
When modifying terms assigned to an object, replace full term recounts
with incrementing/decrementing the count as appropriate. This provides a
significant performance boost on sites with a high number of term/object
relationships and/or posts.
Introduces the functions `wp_increment_term_count()`,
`wp_decrement_term_count()`, `wp_modify_term_count_by()` and
`wp_modify_term_count_by_now()` for updating the term count.
Introduces the function `_wp_prevent_term_counting()` for preventing
double counting on posts that are about to transition.
Adds the parameter `update_count_by_callback` to `register_taxonomy()` to
allow developers to use a custom callback for incrementing or decrementing
a term count.
Props boonebgorges, davidbaumwald, hellofromTonya, johnbillion, lcyh78,
mattoperry, peterwilsoncc, rebasaurus, whyisjake.
Fixes #40351.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40351#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list