pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: n.kobzarev@aeronavigator.ru
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
Cc: 'Laurenz Albe' <laurenz.albe@cybertec.at>
Cc: pgsql-general@lists.postgresql.org
Subject: RE: Unnecessary locks for partitioned tables
Date: Wed, 9 Nov 2022 18:11:01 +0300
Message-ID: <01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru> (raw)
In-Reply-To: <3968476.1668004175@sss.pgh.pa.us>
References: <012801d8f42c$06ea5af0$14bf10d0$@aeronavigator.ru>
	<b6a944c1a7f58d2189b008ac4a523b00c1e124ab.camel@cybertec.at>
	<01a401d8f440$c48bf320$4da3d960$@aeronavigator.ru>
	<3968476.1668004175@sss.pgh.pa.us>


> <n.kobzarev@aeronavigator.ru> writes:
> > Oh, I did not explicitly write that, in case of custom plan (first
attempts or with force_custom_plan) database 
> > holds only a couple of locks! 
> > Why in this > case it is sufficient to lock only one partition and
parent table ?

> Because partition routing is done at planning time in that case, based on
the actual values of the plan's  parameters.  
> A generic plan doesn't have the parameter values available, so it has to
build plan nodes for every partition that could conceivably be accessed.
> So for queries of this kind (ie point queries against heavily partitioned
> tables) the generic plan is pretty much always going to lose.  
> That doesn't bother me enormously --- there are other query patterns with
similar behavior.

> If you know that your queries always need custom plans, I question the
value of using PREPARE at all.
>
>			regards, tom lane


Thank you for your time, Tom.
PREPARE is not mandatory, it is mostly for reproducing purposes. Queries in
stored procedures behaves like prepared statements too, that is expected. 
If someone would create delayed locking for generic plans, after parameters
are known and partition pruning occurs, I believe generic plan will be on
pars with custom.
So, I`m sticking with plan cache parameter for feature development, that was
clear.


Thanks,
Nikolay







view thread (6+ messages)  latest in thread

Message-ID: <01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru>
Permalink:  ../01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru/
Also on:    postgresql.org/message-id/01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru

 · 

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: n.kobzarev@aeronavigator.ru, tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at
  Subject: Re: Unnecessary locks for partitioned tables
  In-Reply-To: <01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru>
  References: <012801d8f42c$06ea5af0$14bf10d0$@aeronavigator.ru> <b6a944c1a7f58d2189b008ac4a523b00c1e124ab.camel@cybertec.at> <01a401d8f440$c48bf320$4da3d960$@aeronavigator.ru> <3968476.1668004175@sss.pgh.pa.us> <01bc01d8f44d$7b7f0250$727d06f0$@aeronavigator.ru>

* 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