clean_post_cache() generates enormous amounts of queries on sites with lots of pages, revisions or attachments
|Reported by:||Denis-de-Bernardy||Owned by:||nacin|
It's recursively doing queries such as this one:
SELECT ID FROM www_posts WHERE post_parent = 592
For one thing it's not checking if has already been run for a particular post/page. If a root page gets cleaned up several times during the same page row, we re-do the whole series of pages, attachments, revisions and what not all over again.
It prompted another thought, too: how important is it to keep non-published data in memcached? It seems to me that we could change wp_cache_add(), etc. in such a way that the non-published data remains available over in the posts bucket, without getting shoved into memcached. Were we to do so, we could change the above query so it adds a constraint on post_status. That's a lot less queries.