pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Robert Haas <rhaas@postgresql.org>
Cc: pgsql-hackers@lists.postgresql.org, David Rowley <drowley@postgresql.org>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: doc: mentioned CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF
Date: Mon, 18 Jul 2022 09:33:04 -0500
Message-ID: <20220718143304.GC18011@telsasoft.com> (raw)

It's easy to use CREATE TABLE..LIKE + ALTER..ATTACH PARTITION to avoid
acquiring a strong lock when creating a new partition.
But it's also easy to forget.

commit 76c0d1198cf2908423b321cd3340d296cb668c8e
Author: Justin Pryzby <pryzbyj@telsasoft.com>
Date:   Mon Jul 18 09:24:55 2022 -0500

    doc: mention CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF
    
    See also: 898e5e3290a72d288923260143930fb32036c00c
    Should backpatch to v12

diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 6bbf15ed1a4..db7d8710bae 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -619,6 +619,16 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       with <literal>DROP TABLE</literal> requires taking an <literal>ACCESS
       EXCLUSIVE</literal> lock on the parent table.
      </para>
+
+     <para>
+      Note that creating a partition acquires an <literal>ACCESS
+      EXCLUSIVE</literal> lock on the parent table.
+      It may be preferable to first CREATE a separate table and then ATTACH it,
+      which does not require as strong of a lock.
+      See <link linkend="sql-altertable-attach-partition">ATTACH PARTITION</link>
+      and <xref linkend="ddl-partitioning"/> for more information.
+     </para>
+
     </listitem>
    </varlistentry>
 





view thread (12+ messages)  latest in thread

Message-ID: <20220718143304.GC18011@telsasoft.com>
Permalink:  ../20220718143304.GC18011@telsasoft.com/
Also on:    postgresql.org/message-id/20220718143304.GC18011@telsasoft.com

 · 

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: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, rhaas@postgresql.org, drowley@postgresql.org, alvherre@alvh.no-ip.org
  Subject: Re: doc: mentioned CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF
  In-Reply-To: <20220718143304.GC18011@telsasoft.com>

* 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