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 1snfsG-005HOz-Qr for pgsql-general@arkaria.postgresql.org; Mon, 09 Sep 2024 15:00:17 +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 1snfsG-00DZ95-FH for pgsql-general@arkaria.postgresql.org; Mon, 09 Sep 2024 15:00:16 +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 1snfsG-00DZ8v-4g for pgsql-general@lists.postgresql.org; Mon, 09 Sep 2024 15:00:16 +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.94.2) (envelope-from ) id 1snfsD-000Jfk-K3 for pgsql-general@postgresql.org; Mon, 09 Sep 2024 15:00:14 +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 489F0C6T3147834; Mon, 9 Sep 2024 11:00:12 -0400 From: Tom Lane To: Fabrice Chapuis cc: pgsql-general@postgresql.org Subject: Re: infinite loop in an update statement In-reply-to: References: Comments: In-reply-to Fabrice Chapuis message dated "Mon, 09 Sep 2024 16:55:01 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3147832.1725894012.1@sss.pgh.pa.us> Date: Mon, 09 Sep 2024 11:00:12 -0400 Message-ID: <3147833.1725894012@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fabrice Chapuis writes: > why this update does not return instantly? > UPDATE table_a a > SET col1 = (SELECT MIN(b.col1) > FROM table_b b > WHERE b.col2 = a.col2) Maybe query is waiting for a lock on one of those tables? regards, tom lane