pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Lionel Bouton <lionel.bouton@jtek.fr>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Reconstructing transaction content after the fact
Date: Wed, 2 Sep 2020 15:26:20 -0400
Message-ID: <20200902192620.GA26472@alvherre.pgsql> (raw)
In-Reply-To: <338420.1599065418@sss.pgh.pa.us>

On 2020-Sep-02, Tom Lane wrote:

> Lionel Bouton <lionel.bouton@jtek.fr> writes:

> > Are these t_xmin values ever cleaned up (by VACUUM or another mechanism)
> > ? If positive is there a way to configure the approximate time during
> > which these values can be recovered ?
> 
> See VACUUM FREEZE.  You couldn't hide connections immediately after
> insertion, but if the idea is to sanitize every so often, it'd help.

Starting with 9.4 which introduced the use of HEAP_XMIN_FROZEN
combination in infomask to replace rewriting the xmin value proper, the
Xids will be preserved by freezing, so that won't help.

One option to hide the xids might be to recreate the tables every once
in a while, with something like

BEGIN;
 LOCK TABLE votes;
 DROP TABLE IF EXISTS votes_copy;
 CREATE TABLE votes_copy AS SELECT * FROM votes;
 DROP TABLE votes;
 ALTER TABLE votes_copy RENAME TO votes;
 -- recreate indexes, if any?
COMMIT;

which will make all rows have the same Xmin.  Since the voting process
involves a human act and the tables are not expected to be enormous, it
might not be totally out of the question to do this after every vote, or
in the worst case, once every minute or so.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (5+ messages)  latest in thread

Message-ID: <20200902192620.GA26472@alvherre.pgsql>
Permalink:  ../20200902192620.GA26472@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200902192620.GA26472@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, lionel.bouton@jtek.fr
  Subject: Re: Reconstructing transaction content after the fact
  In-Reply-To: <20200902192620.GA26472@alvherre.pgsql>
  References: <338420.1599065418@sss.pgh.pa.us> <20200902192620.GA26472@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox