Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb6e1ae

Browse files
committed
Improve documentation on DETACH PARTITION lock levels
This was forgotten in71f4c8c.Reported-by: Pavel Luzanov <p.luzanov@postgrespro.ru>Author: Amit Langote <amitlangote09@gmail.com>Discussion:https://postgr.es/m/0688e7c3-8bc8-a3e4-9d8e-3bcbbf3e1f4d@postgrespro.ru
1 parentc978738 commitdb6e1ae

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

‎doc/src/sgml/ddl.sgml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,18 +3915,25 @@ DROP TABLE measurement_y2006m02;
39153915
<para>
39163916
Another option that is often preferable is to remove the partition from
39173917
the partitioned table but retain access to it as a table in its own
3918-
right:
3918+
right. This has two forms:
39193919

39203920
<programlisting>
39213921
ALTER TABLE measurement DETACH PARTITION measurement_y2006m02;
3922+
ALTER TABLE measurement DETACH PARTITION measurement_y2006m02 CONCURRENTLY;
39223923
</programlisting>
39233924

3924-
This allows further operations to be performed on the data before
3925+
These allow further operations to be performed on the data before
39253926
it is dropped. For example, this is often a useful time to back up
39263927
the data using <command>COPY</command>, <application>pg_dump</application>, or
39273928
similar tools. It might also be a useful time to aggregate data
39283929
into smaller formats, perform other data manipulations, or run
3929-
reports.
3930+
reports. The first form of the command requires an
3931+
<literal>ACCESS EXCLUSIVE</literal> lock on the parent table.
3932+
Adding the <literal>CONCURRENTLY</literal> qualifier as in the second
3933+
form allows the detach operation to require only
3934+
<literal>SHARE UPDATE EXCLUSIVE</literal> lock on the parent table, but see
3935+
<link linkend="sql-altertable-detach-partition"><literal>ALTER TABLE ... DETACH PARTITION</literal></link>
3936+
for details on the restrictions.
39303937
</para>
39313938

39323939
<para>
@@ -4163,17 +4170,6 @@ ALTER INDEX measurement_city_id_logdate_key
41634170
might be poor.)
41644171
</para>
41654172
</listitem>
4166-
4167-
<listitem>
4168-
<para>
4169-
Some operations require a stronger lock when using declarative
4170-
partitioning than when using table inheritance. For example,
4171-
removing a partition from a partitioned table requires taking
4172-
an <literal>ACCESS EXCLUSIVE</literal> lock on the parent table,
4173-
whereas a <literal>SHARE UPDATE EXCLUSIVE</literal> lock is enough
4174-
in the case of regular inheritance.
4175-
</para>
4176-
</listitem>
41774173
</itemizedlist>
41784174
</para>
41794175

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
967967
</listitem>
968968
</varlistentry>
969969

970-
<varlistentry>
970+
<varlistentry id="sql-altertable-detach-partition">
971971
<term><literal>DETACH PARTITION <replaceable class="parameter">partition_name</replaceable> [ CONCURRENTLY | FINALIZE ]</literal></term>
972972

973973
<listitem>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp