Thread

  1. Re: Experimental patch for terminating VACUUM freeze blockers

    Nathan Bossart <nathandbossart@gmail.com> — 2026-05-13T14:23:26Z

    On Wed, May 13, 2026 at 07:56:43PM +0800, wenhui qiu wrote:
    > I have an experimental patch to explore handling this situation. The patch
    > adds a GUC, vacuum_freeze_terminate_blockers_pid, which allows VACUUM to
    > terminate regular client backends whose transaction horizon blocks VACUUM
    > from advancing its freeze cutoff. The intended targets are
    > idle-in-transaction sessions and long-running active transactions that are
    > holding an old xmin or assigned XID.
    
    Thanks for sharing.  I certainly agree that this area has room for
    improvement in Postgres.
    
    > The patch deliberately does not try to handle other causes of freeze
    > horizon retention, such as replication slots, hot standby feedback, or
    > prepared transactions.
    
    My experience is a bit dated, but I remember the two main issues being
    replication slots and temporary tables.  We now have
    idle_replication_slot_timeout, and there's a somewhat active thread on an
    XID version of that parameter [0], but I'm not aware of any recent ideas
    about how to deal with stranded temporary tables.  I'd encourage you to
    think about these problems, too.
    
    [0] https://postgr.es/m/CA%2B-JvFsMHckBMzsu5Ov9HCG3AFbMh056hHy1FiXazBRtZ9pFBg%40mail.gmail.com
    
    -- 
    nathan