Re: Do we need to handle orphaned prepared transactions in the server?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Kellerer <shammat(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Do we need to handle orphaned prepared transactions in the server?
Date: 2020-04-16 05:32:24
Message-ID: CAMsr+YFk=FuyLV2sqcYx9Y8xfB-y6rMO70KcbnjuKria2_rAWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 16 Apr 2020 at 13:23, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:

>
> Just discarding the prepared xacts is not the answer though.
>

... however, I have wondered a few times about making vacuum smarter about
cases where the xmin is held down by prepared xacts or by replication
slots. If we could record the oldest *and newest* xid needed by such
resource retention markers we could potentially teach vacuum to remove
intermediate dead rows. For high-churn workloads like like workqueue
applications that could be a really big win.

We wouldn't need to track a fine-grained snapshot with an in-progress list
(or inverted in-progress list like historic snapshots) for these. We'd just
remember the needed xid range in [xmin,xmax] form. And we could even do the
same for live backends' PGXACT - it might not be worth the price there, but
if you have workloads that have batch xacts + high churn rate xacts it'd be
pretty appealing.

It wouldn't help with xid wraparound concerns, but it could help a lot with
bloat caused by old snapshots for some very common workloads.

--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-04-16 05:40:09 Re: pg_restore: could not close data file: Success
Previous Message Craig Ringer 2020-04-16 05:23:36 Re: Do we need to handle orphaned prepared transactions in the server?