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 1o8eVk-0008S7-KW for pgsql-general@arkaria.postgresql.org; Tue, 05 Jul 2022 09:06: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 1o8eVj-0000id-2c for pgsql-general@arkaria.postgresql.org; Tue, 05 Jul 2022 09:06: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 1o8eVi-0000iU-LO for pgsql-general@lists.postgresql.org; Tue, 05 Jul 2022 09:06:22 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8eVd-0004YS-Bi for pgsql-general@lists.postgresql.org; Tue, 05 Jul 2022 09:06:21 +0000 Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.90_1) (envelope-from ) id 1o8eVV-0006I0-Sb; Tue, 05 Jul 2022 11:06:15 +0200 Received: from localhost ([127.0.0.1]) by sh4-5.1blu.de with esmtp (Exim 4.90_1) (envelope-from ) id 1o8eVV-0005l3-Pg; Tue, 05 Jul 2022 11:06:09 +0200 Date: Tue, 5 Jul 2022 11:06:09 +0200 From: Matthias Apitz To: Laurenz Albe Cc: pgsql-general@lists.postgresql.org Subject: Re: lifetime of the old CTID Message-ID: <20220705090609.GA9@sh4-5.1blu.de> Reply-To: Matthias Apitz References: <20220705075119.GA23@sh4-5.1blu.de> <03ca00a881de408016a907e31d832175b04aeac7.camel@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <03ca00a881de408016a907e31d832175b04aeac7.camel@cybertec.at> X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día Dienstag, Juli 05, 2022 a las 10:40:40 +0200, Laurenz Albe escribió: > On Tue, 2022-07-05 at 09:51 +0200, Matthias Apitz wrote: > > We're using the SQL function currtid2() to get the new CTID of a row > > when this was UPDATEd. > > > > Investigating cases of failing updates, it turns out that the old CTID > > has only a limited lifetime; one can check this with SQL: > > > > sisis=# select ctid, d01gsi from d01buch where d01gsi = '0240564'; > >     ctid    |           d01gsi            > > ------------+----------------------------- > >  (29036,11) | 0240564 > > > > now I update the row and afterwards pick up the new CTID based on the > > old one (29036,11): > > > > sisis=# UPDATE d01buch set d01ort='Wolfratshausen' where d01gsi='0240564'; > > UPDATE 1 > > sisis=# SELECT currtid2('d01buch'::text, '(29036,11)'::tid); > >  currtid2  > > ----------- > >  (29036,7) > > > > Now I go and pick up a coffe in our kitchen and check again: > > > > sisis=# SELECT currtid2('d01buch'::text, '(29036,11)'::tid); > >   currtid2  > > ------------ > >  (29036,11) > > > > i.e. the function now only returns it argument. and not the new CTID > > anymore. > > > > Why is this? And what triggers exactly that the old CTID can't be used > > anymore? > > It is probably the fault of your coffee. Correct, the coffee machine is broken and never does show when the milk powder is empty already :-) > Another explanation could be that the HOT chain was pruned while you were away. What exactly means "the HOT chain was pruned"? What is the HOT chain? Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub