Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubgun-00417r-V2 for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 14:45:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ubguk-002XiX-A1 for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 14:45:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubguj-002XiP-TG for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 14:45:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubguh-007Q7H-1Y for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 14:45:48 +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 56FEjiXp903135; Tue, 15 Jul 2025 10:45:44 -0400 From: Tom Lane To: Laurenz Albe cc: Durgamahesh Manne , pgsql-general Subject: Re: Regarding query optimisation (select for update) In-reply-to: <826536fd65cb6b25e996ac449336ce9c2476174b.camel@cybertec.at> References: <826536fd65cb6b25e996ac449336ce9c2476174b.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Tue, 15 Jul 2025 16:06:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <903133.1752590744.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 15 Jul 2025 10:45:44 -0400 Message-ID: <903134.1752590744@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > Text is easier to read than images... Indeed. > Anyway, this statement was done in under a millisecond. > I wouldn't call that slow... It looks to me like this EXPLAIN ANALYZE was done against a totally empty table, so probably in a freshly-set-up dev environment. That is not going to be helpful in identifying your production problem. Note the caveat at [1]: EXPLAIN results should not be extrapolated to situations much different from the one you are actually testing; for example, results on a toy-sized table cannot be assumed to apply to large tables. regards, tom lane [1] https://www.postgresql.org/docs/current/using-explain.html#USING-EXPLA= IN-CAVEATS