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 1n6ydo-00025e-21 for pgsql-general@arkaria.postgresql.org; Mon, 10 Jan 2022 17:39: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 1n6ydm-0006jX-Oe for pgsql-general@arkaria.postgresql.org; Mon, 10 Jan 2022 17:39: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 1n6ydm-0006jO-EL for pgsql-general@lists.postgresql.org; Mon, 10 Jan 2022 17:39: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 1n6ydk-0006i1-7T for pgsql-general@lists.postgresql.org; Mon, 10 Jan 2022 17:39: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 20AHdQkK2208870; Mon, 10 Jan 2022 12:39:26 -0500 From: Tom Lane To: Dominique Devienne cc: pgsql-general@lists.postgresql.org Subject: Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory In-reply-to: References: Comments: In-reply-to Dominique Devienne message dated "Mon, 10 Jan 2022 18:26:52 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2208868.1641836366.1@sss.pgh.pa.us> Date: Mon, 10 Jan 2022 12:39:26 -0500 Message-ID: <2208869.1641836366@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne writes: > I'm trying to DROP a ROLE that has 4 schemas: > * 2 smallish ones (1 or 2 dozen tables each), > * 2 largish ones (250 tables, totalling around 4000 columns each). > And of course there are various indexes, constraints, etc... on each schema. You're going to need a lock per dropped relation. The number of columns or rows doesn't enter into it, but the number of indexes does. > DDL Error: DROP OWNED BY "Epos-PNS (a73e1fbdcc5b4460ba55703a0d6b6ad7)" > CASCADE: #53200: ERROR: out of shared memory > HINT: You might need to increase max_locks_per_transaction. I'd not have expected that when dropping 500-or-so tables, but maybe you have a lot of indexes per table? > And please note that there could be dozens even hundreds of largish schemas > associated to the dropped ROLE (2 + N), not just the 2+2 it fails with here. There's not a lot of penalty to increasing max_locks_per_transaction, but no you can't make it "unbounded". regards, tom lane