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 1n7Kr5-00077S-3f for pgsql-general@arkaria.postgresql.org; Tue, 11 Jan 2022 17:22:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7Kr3-0008Ly-F6 for pgsql-general@arkaria.postgresql.org; Tue, 11 Jan 2022 17:22:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7Kr1-0008LV-7k for pgsql-general@lists.postgresql.org; Tue, 11 Jan 2022 17:22:41 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7Kqx-0005bq-2F for pgsql-general@lists.postgresql.org; Tue, 11 Jan 2022 17:22:38 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CCA395C01BA; Tue, 11 Jan 2022 12:22:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 11 Jan 2022 12:22:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Z gMJqkhK4qBSNOYHQUlmDAPbTqDaFclaBKgRM8Xq1Sk=; b=cMgtf0OFVs2mBhPXt yM922GGMpc0s8kSAr+lUc79xjmV8Cd9dgbvjsT9bO0c4XGUewNoAY7HJqxdhlNFE xSURHyEjGssE9D8X12fFgBCp4SPdSy2H8+5h4cEgiKxo0kSX6Dc+gRuuXRnnW9qR TJZMzblW0km6dgbdhaM1h2wvUrwvUgpCThoj0v7HK8LwtCqhR6s6Tj67xM9tBAR6 iDF6na0NO00VluCguN9ddgBcqcWmdO3aUtuxceT5V/gc3sXg5plHUoLFbPuL4xyU 55haSPYEpNxGPzKbFqpVKKcsPSXt2vPy9I4lyXOkPuC/NZGPO/1dWakAzgtdeuKd pQQsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ZgMJqkhK4qBSNOYHQUlmDAPbTqDaFclaBKgRM8Xq1 Sk=; b=d/KaQK88PP4i9YODaCIIDjRFloZW5atUiYTGyRHsKFtUh3z5maMBDYItP 92Dm7uw+GEJsuBZVC1Vw6vjnR7J7y8Jh9KOjP3WvSxA8Q3IWN7/2GIOD+owFdqyT cqRbegmVcG3nLS/Zlylqok0/gabPqE2dX/kVNr4ns/wxrE8OfadvJuYaBD7U25KM ObsXk+kQsriCdrfPvawSd3vG7BxWJ+Bw+7k12l/4PMNj0P333MQ63krITGq7bPba hwyVX3J+Y8u5Q9MmfQfmWcOUdLn10KGA9Uz7h4rRQjUea7guz8coeJC7I5D/evLU A/R9NE5AuEl7GI3Ft9PWfsPznbm1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudehfedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepvedvkeeihfduhffhtdekleegffduiefgteejgeff gffhteefleeludfgleelgeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Jan 2022 12:22:31 -0500 (EST) Message-ID: <3d65b46c-f026-da4c-7738-a58ca4d4685d@aklaver.com> Date: Tue, 11 Jan 2022 09:22:30 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory Content-Language: en-US To: Dominique Devienne Cc: Tom Lane , "David G. Johnston" , "pgsql-generallists.postgresql.org" References: <2208869.1641836366@sss.pgh.pa.us> <2412212.1641850186@sss.pgh.pa.us> From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/11/22 01:34, Dominique Devienne wrote: > On Mon, Jan 10, 2022 at 11:13 PM Adrian Klaver > > wrote: > > > I go into use cases in my previous message, send a minute ago. > > In your OP the error occurred here: > DROP OWNED BY "Epos-PNS (a73e1fbdcc5b4460ba55703a0d6b6ad7)" CASCADE > The CASCADE allows to command to recurse to objects that may not be > owned by the specified role. Is that what you want? > > > Sure. Although that's irrelevant. There are no such other objects. Except we did not know that until now. > Each 2+N schemas "instance" is self-contained, and all ROLEs associated > to those SCHEMAs only have privileges associated to those schemas. > > Actual LOGIN USERs are granted access to a subset of ROLEs in > "instances" based on individual permissions. > So when I nuke an "instance", I DROP all its SCHEMAs, and all their > associated ROLEs. Actually you do DROP OWNED BY ... CASCADE. > > And DROP'ing those "instance"-specific ROLEs implicitly severs the > GRANTs made on LOGIN USERs, who remain. > > What is the purpose of the process, clearing out given schema, dropping > objects only owned by a given role, or something else? > > > "dropping objects only owned by a given role" indeed. > I.e. exactly what DROP OWNED BY is designed to do, no? As pointed out it can end up dropping objects owned by other roles due to dependencies. This means DROP OWNED BY ... CASCADE can extend past 'dropping objects only owned by a given role'. > > It just so happens that it seems impossible to do that, because that > involves too many locks :(. It is not impossible, just difficult to predict what to set max_locks_per_transaction to? > > With 1400 relations for each of the N schemas, and actual in-prod > instances at client sites > that require hundreds such schemas (on the current system not based on > PostgreSQL), I'm guessing So now we get to the crux of the issue, this is a migration from another system. It would be useful to know what that system is and how it is handled there. There may be people on this list that have similar experience's. > I can't assign 1400 * 1000 = over a million locks on the cluster, can I? > > So now the question I asked in that other message, is whether I should > use a dedicated DB per "instance" instead? --DD -- Adrian Klaver adrian.klaver@aklaver.com