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 1nSL9k-0007to-8y for pgsql-general@arkaria.postgresql.org; Thu, 10 Mar 2022 15:56:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nSL9j-0006dN-4k for pgsql-general@arkaria.postgresql.org; Thu, 10 Mar 2022 15:56:47 +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 1nSL9i-0006cF-QD for pgsql-general@lists.postgresql.org; Thu, 10 Mar 2022 15:56:46 +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 1nSL9g-0001j4-NP for pgsql-general@postgresql.org; Thu, 10 Mar 2022 15:56:45 +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 22AFuhZa649665; Thu, 10 Mar 2022 10:56:43 -0500 From: Tom Lane To: George Woodring cc: pgsql-general Subject: Re: foreign key on delete cascade order? In-reply-to: References: Comments: In-reply-to George Woodring message dated "Thu, 10 Mar 2022 10:44:40 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <649663.1646927803.1@sss.pgh.pa.us> Date: Thu, 10 Mar 2022 10:56:43 -0500 Message-ID: <649664.1646927803@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk George Woodring writes: > When using FOREIGN KEY ON DELETE CASCADE, is there an order the entries are > being deleted? No, there's no particular attempt to order the deletions. Each cascaded delete ought to be removing a disjoint set of rows in the referencing table, so I'm not quite sure why order should matter. regards, tom lane