Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp site empty doesn't scale #263

Open
2 tasks done
johnbillion opened this issue Aug 25, 2019 · 0 comments
Open
2 tasks done

wp site empty doesn't scale #263

johnbillion opened this issue Aug 25, 2019 · 0 comments

Comments

@johnbillion
Copy link
Contributor

Bug Report

Describe the current, buggy behavior

The time that the wp site empty command takes to run increases approximately linearly to the number of posts, comments, terms, and taxonomies on the site, because of all the querying and cache clearance that happens. This means it scales very poorly.

In addition, the query to fetch comments for deletion is unbounded, which means memory exhaustion could be experience on a site with a very large number of comments.

Describe how other contributors can replicate this bug

  1. Find yourself a site that contains a large number of posts, for example 100,000 or more.
  2. Run time wp site empty --yes and then go and put the kettle on.

Describe what you would expect as the correct outcome

The time that wp site empty takes to run shouldn't be dictated by the number of objects in the database.

Provide a possible solution

Ideally the cache clearance would happen on a per-group basis to avoid the need to delete every cache entry for every object, but I understand that this is typically not possible.

It may be possible to simply call wp_cache_flush() after truncating all the tables to flush the entire cache, although this will have side effects on a Multisite installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants