public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Rowley <[email protected]>
To: Tender Wang <[email protected]>
Cc: PostgreSQL Developers <[email protected]>
Subject: Re: Add mention in docs about locking all partitions for generic plans
Date: Mon, 31 Mar 2025 12:19:38 +1300
Message-ID: <CAApHDvogvzANoTOCyXUWgEuPFx1nT6S63aAN0bDRSJ=TaGBWew@mail.gmail.com> (raw)
In-Reply-To: <CAHewXNm2iCGgi4_+WCJ-nnBPKB1q_uXJzSPArHWV_SaDb=gV+Q@mail.gmail.com>
References: <CAApHDvp738G75HfkKcfXaf3a8s=6mmtOLh46tMD0D2hAo1UCzA@mail.gmail.com>
	<CAHewXN=BbBCcyxPNBrQsF_Sz+i3n2jPf18rGJQwbbz18yD0J6A@mail.gmail.com>
	<CAApHDvoRvkmD3z67hY5jb+eEQUyA1QVZBL8_C30HOTjgRhfHzA@mail.gmail.com>
	<CAHewXNm2iCGgi4_+WCJ-nnBPKB1q_uXJzSPArHWV_SaDb=gV+Q@mail.gmail.com>

On Mon, 24 Mar 2025 at 22:19, Tender Wang <[email protected]> wrote:
>> Maybe I was wrong about writing nothing in master's docs. It might
>> still be important to detail this. I don't know the best way to phrase
>> that, but maybe something along the lines of: "The query planner
>> obtains locks for all partitions which are part of the plan.  However,
>> when the executor uses a cached plan, locks are only obtained on the
>> partitions which remain after partition pruning done during the
>> initialization phase of execution, i.e., the ones shown in the EXPLAIN
>> output and not the ones referred to by the “Subplans Removed”
>> property.".
>>
>> Any opinions?
>
> The above sentence looks good to me.

Thanks for looking.

I've attached the master and the <= v17 in patch form. Also, the
compiled HTML for ease of review.

I'll push these in the next few days unless anyone else wants to voice
their opinions.

David


Attachments:

  [application/x-zip-compressed] ddl-partitioning.html.zip (31.0K, ../CAApHDvogvzANoTOCyXUWgEuPFx1nT6S63aAN0bDRSJ=TaGBWew@mail.gmail.com/2-ddl-partitioning.html.zip)
  download

  [application/octet-stream] v17-0001-Doc-add-information-about-partition-locking.patch (1.4K, ../CAApHDvogvzANoTOCyXUWgEuPFx1nT6S63aAN0bDRSJ=TaGBWew@mail.gmail.com/3-v17-0001-Doc-add-information-about-partition-locking.patch)
  download | inline diff:
From 02c0192816f5247a5fc71a5ad59f28306fb56080 Mon Sep 17 00:00:00 2001
From: David Rowley <[email protected]>
Date: Mon, 31 Mar 2025 12:02:55 +1300
Subject: [PATCH v17] Doc: add information about partition locking

The documentation around locking of partitions for the executor startup
phase of run-time partition pruning wasn't clear about which partitions
were being locked.  Fix that.

Reviewed-by: Tender Wang <[email protected]>
Discussion: https://postgr.es/m/CAApHDvp738G75HfkKcfXaf3a8s%3D6mmtOLh46tMD0D2hAo1UCzA%40mail.gmail.com
Backpatch-through: 12
---
 doc/src/sgml/ddl.sgml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index c150dd217f9..bef12758711 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4986,7 +4986,9 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
        It is possible to determine the number of partitions which were
        removed during this phase by observing the
        <quote>Subplans Removed</quote> property in the
-       <command>EXPLAIN</command> output.
+       <command>EXPLAIN</command> output.  It's important to note that any
+       partitions removed by the partition pruning done at this stage are
+       still locked at the beginning of execution.
       </para>
      </listitem>
 
-- 
2.40.1.windows.1



  [application/octet-stream] v18-0001-Doc-add-information-about-partition-locking.patch (1.6K, ../CAApHDvogvzANoTOCyXUWgEuPFx1nT6S63aAN0bDRSJ=TaGBWew@mail.gmail.com/4-v18-0001-Doc-add-information-about-partition-locking.patch)
  download | inline diff:
From 377f8d69d003a28cca5e34708d4570e75da55807 Mon Sep 17 00:00:00 2001
From: David Rowley <[email protected]>
Date: Mon, 31 Mar 2025 11:53:44 +1300
Subject: [PATCH v18] Doc: add information about partition locking

The documentation around locking of partitions for the executor startup
phase of run-time partition pruning wasn't clear about which partitions
were being locked.  Fix that.

Reviewed-by: Tender Wang <[email protected]>
Discussion: https://postgr.es/m/CAApHDvp738G75HfkKcfXaf3a8s%3D6mmtOLh46tMD0D2hAo1UCzA%40mail.gmail.com
Backpatch-through: 12
---
 doc/src/sgml/ddl.sgml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index cdb1a07e9d3..d2082b7e88e 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -5075,7 +5075,13 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
        It is possible to determine the number of partitions which were
        removed during this phase by observing the
        <quote>Subplans Removed</quote> property in the
-       <command>EXPLAIN</command> output.
+       <command>EXPLAIN</command> output.  The query planner obtains locks for
+       all partitions which are part of the plan.  However, when the executor
+       uses a cached plan, locks are only obtained on the partitions which
+       remain after partition pruning done during the initialization phase of
+       execution, i.e., the ones shown in the <command>EXPLAIN</command>
+       output and not the ones referred to by the
+       <quote>Subplans Removed</quote> property.
       </para>
      </listitem>
 
-- 
2.40.1.windows.1



view thread (6+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Add mention in docs about locking all partitions for generic plans
  In-Reply-To: <CAApHDvogvzANoTOCyXUWgEuPFx1nT6S63aAN0bDRSJ=TaGBWew@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox