[wp-trac] [WordPress Trac] #37703: Optimise `wp_delete_comment` as called from `wp_delete_post`
WordPress Trac
noreply at wordpress.org
Sun Mar 22 02:53:07 UTC 2020
#37703: Optimise `wp_delete_comment` as called from `wp_delete_post`
-------------------------------------------------+-------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Comments | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing dev-feedback | performance
-------------------------------------------------+-------------------------
Comment (by peterwilsoncc):
Notes
* (Bug) Rather than the look for parents, look for grandparents approach
you'll need a while loop to account for great- and great-great-
grandparents, etc, etc.
* (request) I'd prefer to modify `wp_delete_comment` rather than introduce
a second function (we can discuss deprecating the singular and replacing
it with the plural if needs be). Combining will allow
* selecting `meta_id` to be deleted in one query
* calling `wp_update_comment_count()` once (it's a fairly
expensive query)
Generally the goal of above comments are to combine as many queries as
possible.
---
In [attachment:"37703-delete-desc.diff"] I've uploaded the initial change
to avoid reparenting when deleting posts. @johnbillion are you able to
express a view as to whether this can go in to 5.5? I think the bulk
delete changes will need to be early.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37703#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list