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 1qW0nS-001rNN-Ai for pgsql-performance@arkaria.postgresql.org; Tue, 15 Aug 2023 20:37:46 +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 1qW0nQ-0005AB-FZ for pgsql-performance@arkaria.postgresql.org; Tue, 15 Aug 2023 20:37:44 +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 1qW0nQ-00059G-4v for pgsql-performance@lists.postgresql.org; Tue, 15 Aug 2023 20:37:44 +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 1qW0nN-000Jv7-6o for pgsql-performance@lists.postgresql.org; Tue, 15 Aug 2023 20:37:42 +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 37FKbdwQ1174735; Tue, 15 Aug 2023 16:37:39 -0400 From: Tom Lane To: Les cc: pgsql-performance@lists.postgresql.org Subject: Re: slow delete In-reply-to: References: Comments: In-reply-to Les message dated "Tue, 15 Aug 2023 22:23:26 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1174733.1692131859.1@sss.pgh.pa.us> Date: Tue, 15 Aug 2023 16:37:39 -0400 Message-ID: <1174734.1692131859@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Les writes: > It seems that two foreign key constraints use 10.395 seconds out of the > total 11.24 seconds. But I don't see why it takes that much? Probably because you don't have an index on the referencing column. You can get away with that, if you don't care about the speed of deletes from the PK table ... regards, tom lane