pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dominique Devienne <ddevienne@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: About revoking large number of privileges; And the PUBLIC role.
Date: Thu, 07 Jul 2022 18:10:31 +0200
Message-ID: <18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at> (raw)
In-Reply-To: <CAFCRh--nyPj=vOoFRKAr_2_r3=zghw00oMtVrH6u4LhnPDkc1g@mail.gmail.com>
References: <CAFCRh-9Z6V2wt4EsCZMo+wvXBf=sSN9de2Tst-fE99WYTE4Q9Q@mail.gmail.com>
	<2915672.1657201946@sss.pgh.pa.us>
	<CAFCRh--nyPj=vOoFRKAr_2_r3=zghw00oMtVrH6u4LhnPDkc1g@mail.gmail.com>

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





view thread (6+ messages)  latest in thread

Message-ID: <18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at>
Permalink:  ../18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at/
Also on:    postgresql.org/message-id/18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, ddevienne@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: About revoking large number of privileges; And the PUBLIC role.
  In-Reply-To: <18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at>
  References: <CAFCRh-9Z6V2wt4EsCZMo+wvXBf=sSN9de2Tst-fE99WYTE4Q9Q@mail.gmail.com> <2915672.1657201946@sss.pgh.pa.us> <CAFCRh--nyPj=vOoFRKAr_2_r3=zghw00oMtVrH6u4LhnPDkc1g@mail.gmail.com> <18f50dc42b468f6e3959e6b2dca673d90203e767.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox