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 1ntnDH-00050r-ST for pgsql-general@arkaria.postgresql.org; Wed, 25 May 2022 09:21:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntnDE-0001cs-Qs for pgsql-general@arkaria.postgresql.org; Wed, 25 May 2022 09:21:52 +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 1ntnDE-0001cj-GG for pgsql-general@lists.postgresql.org; Wed, 25 May 2022 09:21:52 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntnD7-00027M-Pw for pgsql-general@lists.postgresql.org; Wed, 25 May 2022 09:21:52 +0000 Received: from [188.174.62.182] (helo=pureos) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntnD6-0002gS-0j; Wed, 25 May 2022 11:21:44 +0200 Date: Wed, 25 May 2022 11:21:41 +0200 From: Matthias Apitz To: Tom Lane Cc: Laurenz Albe , pgsql-general@lists.postgresql.org Subject: Re: existing row not found by SELECT ... WHERE CTID = ? Message-ID: Reply-To: Matthias Apitz References: <1652228.1653408709@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1652228.1653408709@sss.pgh.pa.us> X-Operating-System: FreeBSD 13.0-CURRENT r368166 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 188.174.62.182 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día martes, mayo 24, 2022 a las 12:11:49 -0400, Tom Lane escribió: > Laurenz Albe writes: > > It may well be that somebody deleted or updated a few rows between the time > > the cursor was materialized and the time the 50000th row was fetched. > > Even without HOLD, a cursor will return a view of the data as it stood > when the cursor was opened, just as a plain SELECT does. There is > *plenty* of time for another session to get in there if you've been > groveling through 50K records one at a time. Tom, Thanks for pointing us in the right direction where to look for a solution. The CURSOR was opened around 23:11 pm and the CTID not found at 23:21 pm, i.e. ten minutes later. This piece of software does every night some housekeeping work in the circulation area of our LMS (Library Management System) and is meant to run as a standalone job (only one process after the other). We're trying to figure out with the customer if something else was started/running at this time between 23:11 and 23:21, to shut this off in the future. Is it possible that the PostgreSQL 13.1 server does something by its own to invalidate the rowid? matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub