pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: James Sewell <james.sewell@jirotech.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Partitioned tables and locks
Date: Thu, 19 Dec 2019 08:38:36 -0500
Message-ID: <6714.1576762716@sss.pgh.pa.us> (raw)
In-Reply-To: <CAANVwEuOb+B9y2P7h0NruC-dAmf2p1xLJSjm5UMXwTBPAxtjvg@mail.gmail.com>
References: <CAANVwEuOb+B9y2P7h0NruC-dAmf2p1xLJSjm5UMXwTBPAxtjvg@mail.gmail.com>

James Sewell <james.sewell@jirotech.com> 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





view thread (4+ messages)  latest in thread

Message-ID: <6714.1576762716@sss.pgh.pa.us>
Permalink:  ../6714.1576762716@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6714.1576762716@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, james.sewell@jirotech.com
  Subject: Re: Partitioned tables and locks
  In-Reply-To: <6714.1576762716@sss.pgh.pa.us>
  References: <CAANVwEuOb+B9y2P7h0NruC-dAmf2p1xLJSjm5UMXwTBPAxtjvg@mail.gmail.com> <6714.1576762716@sss.pgh.pa.us>

* 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