pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: yotsunaga.naoki@fujitsu.com <yotsunaga.naoki@fujitsu.com>
Cc: Pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Lock acquisition for partition table when setting generic plan
Date: Wed, 15 Jan 2020 10:09:10 -0500
Message-ID: <2183.1579100950@sss.pgh.pa.us> (raw)
In-Reply-To: <OSBPR01MB17999A0FB716887538A340AAF6370@OSBPR01MB1799.jpnprd01.prod.outlook.com>
References: <OSBPR01MB17999A0FB716887538A340AAF6370@OSBPR01MB1799.jpnprd01.prod.outlook.com>

"yotsunaga.naoki@fujitsu.com" <yotsunaga.naoki@fujitsu.com> writes:
> I did the following.
> Even though I accessed one partition table(test2 table), I also acquired locks on other partition tables(test1 table).
> I expected to acquire locks on the parent table(test table) and the partition table to access(test2 table).
> Why does this happen?

You specified a generic plan:

> postgres=# set plan_cache_mode = force_generic_plan ;

so you are not going to get any plan-time optimization based on knowing
the id parameter.  Therefore the plan must include sub-plan nodes for
every child table, so executing it requires locking all those tables
to make sure their schemas haven't changed.

			regards, tom lane





view thread (2+ messages)

Message-ID: <2183.1579100950@sss.pgh.pa.us>
Permalink:  ../2183.1579100950@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2183.1579100950@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, yotsunaga.naoki@fujitsu.com
  Subject: Re: Lock acquisition for partition table when setting generic plan
  In-Reply-To: <2183.1579100950@sss.pgh.pa.us>
  References: <OSBPR01MB17999A0FB716887538A340AAF6370@OSBPR01MB1799.jpnprd01.prod.outlook.com> <2183.1579100950@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