Re: Partitioned tables and locks

Tom Lane <[email protected]> Thu, 19 Dec 2019 08:38:36 -0500
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
James Sewell <[email protected]> writes:
> Is it expected that a lock on a partitioned table will take out 2 locks per
> child regardless of the number of children which are excluded at plan time?

Depends on the details of your query, and on which PG version you're
using, but it's by no means surprising for each child table to get
locked.  (I'm not sure where *two* locks would come from, though.)

If you're working with massively partitioned tables, increasing
max_locks_per_transaction is a good idea.

			regards, tom lane