diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-16 16:50:56 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-16 16:50:56 -0400 |
| commit | b0488cb5113746a2847964c5cb26e5dc0e302b55 (patch) | |
| tree | 2e8e2771d30dab6473d70c5ae0e4d9baf2c2f4e5 /doc/src/sgml/ref/create_table.sgml | |
| parent | 3908d6ae115801cc61486b286ab71d91c2cdbb99 (diff) | |
Doc: mention CREATE+ATTACH PARTITION with CREATE TABLE...PARTITION OF.
Clarify that ATTACH/DETACH PARTITION can be used to perform partition
maintenance with less locking than straight CREATE TABLE/DROP TABLE.
This was already stated in some places, but not emphasized.
Back-patch to v14 where DETACH PARTITION CONCURRENTLY was added.
(We had lower lock levels for ATTACH PARTITION before that, but
this wording wouldn't apply.)
Justin Pryzby, reviewed by Robert Treat and Jakub Wartak;
a little further wordsmithing by me
Discussion: https://postgr.es/m/20220718143304.GC18011@telsasoft.com
Diffstat (limited to 'doc/src/sgml/ref/create_table.sgml')
| -rw-r--r-- | doc/src/sgml/ref/create_table.sgml | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 833cae7c5d0..c1b6beb6172 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -586,12 +586,24 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM </para> <para> - Operations such as TRUNCATE which normally affect a table and all of its + Operations such as <command>TRUNCATE</command> + which normally affect a table and all of its inheritance children will cascade to all partitions, but may also be - performed on an individual partition. Note that dropping a partition - with <literal>DROP TABLE</literal> requires taking an <literal>ACCESS - EXCLUSIVE</literal> lock on the parent table. + performed on an individual partition. </para> + + <para> + Note that creating a partition using <literal>PARTITION OF</literal> + requires taking an <literal>ACCESS EXCLUSIVE</literal> lock on the + parent partitioned table. Likewise, dropping a partition + with <command>DROP TABLE</command> requires taking + an <literal>ACCESS EXCLUSIVE</literal> lock on the parent table. + It is possible to use <link linkend="sql-altertable"><command>ALTER + TABLE ATTACH/DETACH PARTITION</command></link> to perform these + operations with a weaker lock, thus reducing interference with + concurrent operations on the partitioned table. + </para> + </listitem> </varlistentry> |
