Skip to content

Module Proposal: Clean transient options (wp_options table) #349

Closed as not planned

Description

@merkys7

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

Activity

  1. mxbclang commented on Jun 3, 2022

    @mxbclang
    Contributor

    @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?

  2. merkys7 commented on Jun 4, 2022

    @merkys7
    MemberAuthor

    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()
    
  3. tillkruss commented on Jun 6, 2022

    @tillkruss
    Member

    It'd be interesting to see the bytes as well.

  4. peterwilsoncc commented on Jun 8, 2022

    @peterwilsoncc
    Contributor

    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.

  5. mxbclang commented on Jun 13, 2022

    @mxbclang
    Contributor

    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!

  6. removed
    no milestonePRs that do not have a defined milestone for release
    on Jun 22, 2022
  7. merkys7 commented on Jul 14, 2022

    @merkys7
    MemberAuthor

    Thank you @bethanylang I will begin working with it shortly

  8. JoelEadeDesign commented on Jul 23, 2022

    @JoelEadeDesign

    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 :)

  9. changed the title [-]Clean transient options (wp_options table)[/-] [+]Module proposal: Clean transient options (wp_options table)[/+] on Aug 17, 2022
  10. changed the title [-]Module proposal: Clean transient options (wp_options table)[/-] [+]Module Proposal: Clean transient options (wp_options table)[/+] on Aug 17, 2022
  11. johnbillion commented on Mar 13, 2023

    @johnbillion
    Member

    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.

  12. Mte90 commented on Apr 2, 2023

    @Mte90

    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.

  13. swissspidy commented on Jan 27, 2025

    @swissspidy
    Member

    So, expired transients are already automatically deleted by WordPress, and we already have #526 to optimize autoloaded options, so I don't think anything really needs to be done here.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions