Open merkys7 opened 2 years ago
@merkys7 Thank you for this suggestion! Can you clarify that your intention here is that this would be a button or some other kind of option within the Performance Lab plugin settings?
I think we could display transient count / size in site-health checks using SQL query
SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '_transient_timeout%' AND option_value < " . time()
and a button to clean it using SQL query
DELETE FROM `$wpdb->options` WHERE option_name LIKE '_transient_timeout%' AND option_value < " . time()
It'd be interesting to see the bytes as well.
WordPress has an existing function for the query above, delete_expired_transients()
, that ought to run daily on a scheduled task (ref).
Something in site health to delete expired, all, or auto-loaded transients would be lovely if they get large.
Thanks @merkys7! This would be a new plugin module, then. To move this forward, the next step would be to revamp this issue to become a proper module proposal. See the following documentation:
Once the details noted above are added to this issue, we can discuss this with the broader team in a future performance chat. Let me know if you have any questions. Thanks!
Thank you @bethanylang I will begin working with it shortly
Nothing to contribute other than I suspect this is the cause of a client's site with a 159GB options table. I can Optimize
the table every few days but finding this thread eases my mind that I won't have to do it ongoing :)
Can we clarify what's being proposed here? As Pete mentioned, there's already a daily cron event which clears out expired transients.
What exactly is the problem looking to be solved?
I'm not sure I'm keen on adding a button to clear out all transients, or large transients, because a user needs to be able to make an informed decision about whether to click it, and it can cause cache stampedes on subsequent page requests as transient values are repopulated and re-cached.
Can we clarify what's being proposed here? As Pete mentioned, there's already a daily cron event which clears out expired transients.
What exactly is the problem looking to be solved?
I'm not sure I'm keen on adding a button to clear out all transients, or large transients, because a user needs to be able to make an informed decision about whether to click it, and it can cause cache stampedes on subsequent page requests as transient values are repopulated and re-cached.
I agree it isn't clear the focus of this ticket. Maybe can be more interesting to get the list of the most huge transients that are in autoload as example, usually it is something that I do when I am try to check the performances to see if some plugins is doing badly something.
Feature Description
Expired Transients
Transients are the result of a form of caching that can happen in the WordPress database with the results of remote API calls. This option could clears all of the expired transients from the database.
Introduce a modal that would check and clean transient options