Open drzraf opened 6 years ago
I see the same problem but I do understand that the hard option really needs to go through the hooks as that is the best way to guarantee compatibility with other themes and plugins.
The current option of not using --hard
is however really problematic as it's leaving behind a lot of orphaned metadata for the posts which in may cases are actually the main data size that we want to remove with the revisions.
If acceptable as a good idea I could provide a PR dropping the metadata along with the posts when using the normal quick path (I don't see a reason to keep the variant where only postdata and not postmeta is deleted).
Somehow related: https://core.trac.wordpress.org/ticket/34848
Sample database (lines, size in MB)
Then individual DELETE are runs which is very slow:
because wp_delete_post_revision basically does:
And that wp_delete_post itself is slow.
Could we think about a
--quick
which simplyDELETE FROM {postmeta} WHERE post_id IN ( implode( <deleted_post_id> ) )
?