Re: Experimental patch for terminating VACUUM freeze blockers

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Experimental patch for terminating VACUUM freeze blockers
Date: 2026-05-13 14:23:26
Message-ID: agSJXgqhAhTRQdcI@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavlo Golub 2026-05-13 14:38:20 [PATCH v4] pg_stat_statements: Add last_execution_start column
Previous Message Junwang Zhao 2026-05-13 14:20:01 Re: [SQL/PGQ] Early pruning for GRAPH_TABLE path generation