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 1ntX8W-0000V7-FP for pgsql-general@arkaria.postgresql.org; Tue, 24 May 2022 16:11:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntX8V-0004XD-6t for pgsql-general@arkaria.postgresql.org; Tue, 24 May 2022 16:11:55 +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 1ntX8U-0004X3-SS for pgsql-general@lists.postgresql.org; Tue, 24 May 2022 16:11:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntX8S-0001mq-Lj for pgsql-general@lists.postgresql.org; Tue, 24 May 2022 16:11:54 +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 24OGBnFK1652229; Tue, 24 May 2022 12:11:49 -0400 From: Tom Lane To: Laurenz Albe cc: Matthias Apitz , pgsql-general@lists.postgresql.org Subject: Re: existing row not found by SELECT ... WHERE CTID = ? In-reply-to: References: Comments: In-reply-to Laurenz Albe message dated "Tue, 24 May 2022 17:50:14 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1652227.1653408709.1@sss.pgh.pa.us> Date: Tue, 24 May 2022 12:11:49 -0400 Message-ID: <1652228.1653408709@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. regards, tom lane