From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory
Date: Mon, 10 Jan 2022 16:48:40 -0300
Message-ID: <202201101948.vbo2sxytus45@alvherre.pgsql> (raw)
In-Reply-To: <CAFCRh--no2WL5OhSndVo=dkCfA7OAoEDd7wJPqj+QAxp7TqnaA@mail.gmail.com>
On 2022-Jan-10, Dominique Devienne wrote:
> Given max_locks_per_transaction * (max_connections
> <https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS;
> + max_prepared_transactions
> <https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS;)
> from
> https://www.postgresql.org/docs/current/runtime-config-locks.html, and
> max_conn being 100, that's not many locks.
6400 locks, to be precise. So if your schemas have on average 10 tables
each with 3 indexes per table, you could drop at most 160 schemas in one
go (but only if you're lucky.)
> Given there's only 64 locks per conn by default, how can this work with
> over 100 tables?
> I'm confused... --DD
That value indicates the maximum number of locks that can be taken
across all sessions at a time. You can have a single session take that
number of locks, or all sessions take 64 locks each.
If you really have many more relations that need to be dropped, you
could try to issue "DROP SCHEMA...CASCADE" for each schema to drop.
It's a lot less convenient than DROP OWNED BY, but it doesn't require to
take as many locks simultaneously.
--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"Los trabajadores menos efectivos son sistematicamente llevados al lugar
donde pueden hacer el menor daño posible: gerencia." (El principio Dilbert)
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: alvherre@alvh.no-ip.org, ddevienne@gmail.com
Subject: Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory
In-Reply-To: <202201101948.vbo2sxytus45@alvherre.pgsql>
References: <CAFCRh--no2WL5OhSndVo=dkCfA7OAoEDd7wJPqj+QAxp7TqnaA@mail.gmail.com> <202201101948.vbo2sxytus45@alvherre.pgsql>
* 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