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 1o8e8L-0007Nq-Gk for pgsql-general@arkaria.postgresql.org; Tue, 05 Jul 2022 08:42:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o8e8K-0007T1-8f for pgsql-general@arkaria.postgresql.org; Tue, 05 Jul 2022 08:42:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8e6v-0002dt-O0 for pgsql-general@lists.postgresql.org; Tue, 05 Jul 2022 08:40:45 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o8e6t-00012G-GM for pgsql-general@lists.postgresql.org; Tue, 05 Jul 2022 08:40:45 +0000 Received: by mail-wr1-x429.google.com with SMTP id q9so16467652wrd.8 for ; Tue, 05 Jul 2022 01:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=qqbDPp5PBS1onfeNoTI1dwDkffe7kq0kIspEPWWx7Mo=; b=05aw2CcgzkuBqnwvUi6Y30iMQthjT9Oj/lE0HICvrQ33zmCoNVTeCYJaZ4iIFqkCsJ /94fa66j0dsOH+27nW1uWi/SkDRwORu0Y5SzzaJ003qqR5SHE3Uqpy05ICMM7YXmaxW2 LZ1G0+tJ2zeh0GIVH/2qdv6SHGLF49cYn/zxa4IXgQVrPura91SwK5U7wHRVDMXbUWY4 PrjiD/YhliJMpnSNNZXJh/pQUI7ZDJLg7TSsUjekcftXLHiYY4AIcc9uvfIpPfuhoz3v T7YIgAvhNCVbtQqcKJomJqq0n8uNDPnxHFRzJxb9Z6wwhnZD1VvkcxTmYB0IF7O/H2uP rW5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=qqbDPp5PBS1onfeNoTI1dwDkffe7kq0kIspEPWWx7Mo=; b=cOeSDEWNL4mpzJkPBvKO9d+B0Ot1w2Ad44iYX3mS11lZL6Pf04pXTwO/KUjqChNOgM p88pm3w0KCSpqg/4A60rrjCHJ/GD2mq8KejNaTKTs6J0/JCQ0iM80sgxXRjBGz2zO5YD CzIW3AnOL0p2y62JTgUhCNkOj6QoStwOTPLmOmGrM+SVnvfCw85qZlL2KbSAIG8GjEW0 8trmN9HBLMcNrOTcDZO5fBd730fGr84fX1+mGWoEoEayYC/5jtizt1fmhTqwcaEaDN6C /IvsBFfyC4jRiBpkqBtCuksK/uPLYWdSk52T0AgU+GLlcQomJB6mDu8V+e/wcDK37Beq x9kw== X-Gm-Message-State: AJIora+p3S3BuGxRmQC2iMSiWzbKBz+iKseg+m/x+mHBTNklfPznYuI8 uPMNkFGJn04OIvt9HjUhm3qa1A== X-Google-Smtp-Source: AGRyM1ucNFV1i0dydnkjsLhNYmF6ppo7xdzMSmHGGChknBUNC/tytKn4u29RmI+a00PNdcxQhLNhbQ== X-Received: by 2002:adf:db12:0:b0:21b:970b:e882 with SMTP id s18-20020adfdb12000000b0021b970be882mr31827995wri.6.1657010441512; Tue, 05 Jul 2022 01:40:41 -0700 (PDT) Received: from localhost.localdomain ([88.116.133.170]) by smtp.gmail.com with ESMTPSA id v192-20020a1cacc9000000b003975c7058bfsm22207002wme.12.2022.07.05.01.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 01:40:41 -0700 (PDT) Message-ID: <03ca00a881de408016a907e31d832175b04aeac7.camel@cybertec.at> Subject: Re: lifetime of the old CTID From: Laurenz Albe To: Matthias Apitz , pgsql-general@lists.postgresql.org Date: Tue, 05 Jul 2022 10:40:40 +0200 In-Reply-To: <20220705075119.GA23@sh4-5.1blu.de> References: <20220705075119.GA23@sh4-5.1blu.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. Another explanation could be that the HOT chain was pruned while you were away. Yours, Laurenz Albe