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 1o9U5O-0007AJ-J1 for pgsql-general@arkaria.postgresql.org; Thu, 07 Jul 2022 16:10:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9U5N-0006LF-9Z for pgsql-general@arkaria.postgresql.org; Thu, 07 Jul 2022 16:10:37 +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 1o9U5M-0006L6-T7 for pgsql-general@lists.postgresql.org; Thu, 07 Jul 2022 16:10:36 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o9U5K-0000BM-AJ for pgsql-general@lists.postgresql.org; Thu, 07 Jul 2022 16:10:36 +0000 Received: by mail-ej1-x62c.google.com with SMTP id u15so8829603ejx.9 for ; Thu, 07 Jul 2022 09:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=zrGZljQSsp1ft31fsTP3gMJ6RYlM/iw8oujQu5DZRws=; b=tmneCQGc/i83lAst/dJ341U9e6/URD2FzG4sPeDQ5Aac9zSKT3uN32j+xPyRodNDhd 9m6lky2YSKrbYYM/DvS2hhC07V5BavjgCZIk90yDpbMXeu3G3eS+iJlF7s1fKP6eGswF +l3DDcga7l8NZjEDi5I9Om393U+oi94B1PedtwbibfOPrWSAF5JkDQ1McCrB2Td/Eb9p tTyApVTaqYVqFOMYB4Ye+6jmWMtdVDbVmtYTQOQ25Pu0rC08LtonJ/NWaMnkNl7CWTX/ n/F+9H31AqX2qIPI35iSy6PLdZlOWJ/ZOpVLOCMfCoDVUjxCOdUm7G5gii9KGCc7jnQB CMag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=zrGZljQSsp1ft31fsTP3gMJ6RYlM/iw8oujQu5DZRws=; b=R1eN7mRnPIXTwkVabM3Xplwcb5R9C6fDsEBaVXadriw42BT/tBvi0UYHkXU7YZNOh9 H7LJdX+LAFg9NKuP00j15SzLGaBMpZgQcD37pu+36yuYnXutHvrNQNZlF88X9g0oDu6O kUCC/33eUfq9bYB7sGehgX6JagRUIz1tkjVTxdeaH9FqVU3mxB2oRrVqc2tQRffFzEv6 frhSHEnKZxnogACSOOST3bB6FxkdZCpFRNXUt76bAQuM63YNGRZLFaDb2bNH09UDVLEs 3MTFl3/sHon3CG3+aZZwxdySGjTF3Tw2jZzOEUpN3w7vdQXjSMzihFCMNBTom3dkgFZV Zxlg== X-Gm-Message-State: AJIora98ZgoFWfy/dinubF75jWsRsm6XDF7L6EUklCr7R7l3niBCSSRS 1NG5iyAx/ng5Frq3g62zlB2vzA== X-Google-Smtp-Source: AGRyM1vIJjXkA1exeCNEij4jYCRFZpZ3RMBHys+j3AeCl4+hkUQhz41qp4VjwNd5axug0Fcp0FIrEQ== X-Received: by 2002:a17:907:a427:b0:71b:6f0b:8beb with SMTP id sg39-20020a170907a42700b0071b6f0b8bebmr44912592ejc.496.1657210232346; Thu, 07 Jul 2022 09:10:32 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:b5b1:ba36:b4e1:9793:ff80]) by smtp.gmail.com with ESMTPSA id h7-20020a1709070b0700b00711d8696de9sm19042398ejl.70.2022.07.07.09.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 09:10:31 -0700 (PDT) Message-ID: <18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at> Subject: Re: About revoking large number of privileges; And the PUBLIC role. From: Laurenz Albe To: Dominique Devienne , Tom Lane Cc: pgsql-general@lists.postgresql.org Date: Thu, 07 Jul 2022 18:10:31 +0200 In-Reply-To: References: <2915672.1657201946@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2022-07-07 at 16:36 +0200, Dominique Devienne wrote: > > > So my goal is to delete all those "db specific" ROLEs, then the DB > > > with all its schemas. > > > Which implies REVOKE'ing grants on all those "db specific" ROLEs first. > > > > You should not really have to revoke those manually. > > The normal process for that is to use DROP OWNED BY. > > Except we already went through that, that DROP OWNED BY acquires too many locks. > Increasing max_locks_per_transaction when it fails is just not an option IMHO. > One user had to raise it to 32K for his particular DB, which is not > even that large. > > Or are you saying setting it to 1M or 1B is "safe", and should be > required setup for users? If you want to do this on a routine basis, you are doing something wrong. Never grant a user privileges if the user could be removed. Use groups in that case. For a one-time cleanup operation, increasing "max_locks_per_transaction" and restarting is painful, but not impossible. See it as down time. > Is revoking privileges taking locks? Yes. > Is dropping a DB taking locks? Not a lot. That should never be a problem. > If neither are, then I can work around the limitations of DROP OWNED BY. > > So will the community help me figure this out? > > BTW, I'm also hoping revoking privs, and dropping roles and dbs will > be faster than DROP OWNED BY. > That DB took 30min to 1h to get rid of, via DROP OWNED BY, which seems > to long to delete a bunch of files, no? As I wrote, avoid getting there in the first place. Yours, Laurenz Albe