Improve documentation on DETACH PARTITION lock levels
This was forgotten in 71f4c8c6f74b. 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
This commit is contained in:
parent
c9787385db
commit
db6e1aeb95
@ -3915,18 +3915,25 @@ DROP TABLE measurement_y2006m02;
|
|||||||
<para>
|
<para>
|
||||||
Another option that is often preferable is to remove the partition from
|
Another option that is often preferable is to remove the partition from
|
||||||
the partitioned table but retain access to it as a table in its own
|
the partitioned table but retain access to it as a table in its own
|
||||||
right:
|
right. This has two forms:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ALTER TABLE measurement DETACH PARTITION measurement_y2006m02;
|
ALTER TABLE measurement DETACH PARTITION measurement_y2006m02;
|
||||||
|
ALTER TABLE measurement DETACH PARTITION measurement_y2006m02 CONCURRENTLY;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
This allows further operations to be performed on the data before
|
These allow further operations to be performed on the data before
|
||||||
it is dropped. For example, this is often a useful time to back up
|
it is dropped. For example, this is often a useful time to back up
|
||||||
the data using <command>COPY</command>, <application>pg_dump</application>, or
|
the data using <command>COPY</command>, <application>pg_dump</application>, or
|
||||||
similar tools. It might also be a useful time to aggregate data
|
similar tools. It might also be a useful time to aggregate data
|
||||||
into smaller formats, perform other data manipulations, or run
|
into smaller formats, perform other data manipulations, or run
|
||||||
reports.
|
reports. The first form of the command requires an
|
||||||
|
<literal>ACCESS EXCLUSIVE</literal> lock on the parent table.
|
||||||
|
Adding the <literal>CONCURRENTLY</literal> qualifier as in the second
|
||||||
|
form allows the detach operation to require only
|
||||||
|
<literal>SHARE UPDATE EXCLUSIVE</literal> lock on the parent table, but see
|
||||||
|
<link linkend="sql-altertable-detach-partition"><literal>ALTER TABLE ... DETACH PARTITION</literal></link>
|
||||||
|
for details on the restrictions.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -4163,17 +4170,6 @@ ALTER INDEX measurement_city_id_logdate_key
|
|||||||
might be poor.)
|
might be poor.)
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Some operations require a stronger lock when using declarative
|
|
||||||
partitioning than when using table inheritance. For example,
|
|
||||||
removing a partition from a partitioned table requires taking
|
|
||||||
an <literal>ACCESS EXCLUSIVE</literal> lock on the parent table,
|
|
||||||
whereas a <literal>SHARE UPDATE EXCLUSIVE</literal> lock is enough
|
|
||||||
in the case of regular inheritance.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry id="sql-altertable-detach-partition">
|
||||||
<term><literal>DETACH PARTITION <replaceable class="parameter">partition_name</replaceable> [ CONCURRENTLY | FINALIZE ]</literal></term>
|
<term><literal>DETACH PARTITION <replaceable class="parameter">partition_name</replaceable> [ CONCURRENTLY | FINALIZE ]</literal></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user