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 1pFqkO-0005Dq-2N for pgsql-general@arkaria.postgresql.org; Thu, 12 Jan 2023 06:07:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFqkM-0004p2-TA for pgsql-general@arkaria.postgresql.org; Thu, 12 Jan 2023 06:07:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFqkM-0004ot-Ip for pgsql-general@lists.postgresql.org; Thu, 12 Jan 2023 06:07:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFqkJ-0005Mh-VP for pgsql-general@lists.postgresql.org; Thu, 12 Jan 2023 06:07:29 +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 30C67QTO899475; Thu, 12 Jan 2023 01:07:26 -0500 From: Tom Lane To: Ron cc: pgsql-general Subject: Re: EXPLAIN and FK references? In-reply-to: <269a6794-aa20-283d-bbc4-8cddaa2038de@gmail.com> References: <269a6794-aa20-283d-bbc4-8cddaa2038de@gmail.com> Comments: In-reply-to Ron message dated "Wed, 11 Jan 2023 23:42:04 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <899473.1673503646.1@sss.pgh.pa.us> Date: Thu, 12 Jan 2023 01:07:26 -0500 Message-ID: <899474.1673503646@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron writes: > Deletes are slow in one table with many indices and FK references. That's > not surprising, but it's *VERY* slow, and I'm trying to figure out why. > Is there any EXPLAIN option which shows what "query plans" Pg is using when > checking FK references (index scan, seq scan, etc) during deletes (and > inserts and updates)? No, not directly, but you could look at EXPLAIN ANALYZE to see which of the RI triggers is eating the time. It's not going to be hard to figure out which one(s) are using indexed plans and which are not. regards, tom lane