Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDVxo-0004zn-N1 for pgsql-general@arkaria.postgresql.org; Wed, 02 Sep 2020 16:50:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDVxn-0003fJ-Jx for pgsql-general@arkaria.postgresql.org; Wed, 02 Sep 2020 16:50:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDVxn-0003fB-9U for pgsql-general@lists.postgresql.org; Wed, 02 Sep 2020 16:50:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDVxk-0005dj-S1 for pgsql-general@lists.postgresql.org; Wed, 02 Sep 2020 16:50:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 082GoIi6338421; Wed, 2 Sep 2020 12:50:18 -0400 From: Tom Lane To: Lionel Bouton cc: pgsql-general@lists.postgresql.org Subject: Re: Reconstructing transaction content after the fact In-reply-to: <091ea8f4-1530-40b7-ff01-56576903a4b1@jtek.fr> References: <091ea8f4-1530-40b7-ff01-56576903a4b1@jtek.fr> Comments: In-reply-to Lionel Bouton message dated "Wed, 02 Sep 2020 17:45:53 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <338419.1599065418.1@sss.pgh.pa.us> Date: Wed, 02 Sep 2020 12:50:18 -0400 Message-ID: <338420.1599065418@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Lionel Bouton writes: > Are txids in table file data indeed a means by which you can recover the > data written by a single transaction (assuming the txids don't overflow > the 32bit limit during the life of the cluster) ? They are. You could reduce the connections between different rows by writing them in different subtransactions of the parent transaction (use SAVEPOINT/RELEASE SAVEPOINT, or exception blocks in plpgsql). But unless there's many parallel transactions writing data, somebody could probably still reconstruct things by assuming that nearby XIDs represent subtransactions of a single transaction. > 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. > Is there a way to access these values by connecting to a PostgreSQL > server instead of analyzing in-memory or on-disk data ? SELECT xmin, ... FROM votes; regards, tom lane