doc: Clarify use of ACCESS EXCLUSIVE lock in various sections
authorMichael Paquier <[email protected]>
Thu, 1 Apr 2021 06:29:12 +0000 (15:29 +0900)
committerMichael Paquier <[email protected]>
Thu, 1 Apr 2021 06:29:12 +0000 (15:29 +0900)
Some sections of the documentation used "exclusive lock" to describe
that an ACCESS EXCLUSIVE lock is taken during a given operation.  This
can be confusing to the reader as ACCESS SHARE is allowed with an
EXCLUSIVE lock is used, but that would not be the case with what is
described on those parts of the documentation.

Author: Greg Rychlewski
Discussion: https://postgr.es/m/CAKemG7VptD=7fNWckFMsMVZL_zzvgDO6v2yVmQ+ZiBfc_06kCQ@mail.gmail.com
Backpatch-through: 9.6

doc/src/sgml/ddl.sgml
doc/src/sgml/hstore.sgml
doc/src/sgml/indexam.sgml
doc/src/sgml/maintenance.sgml
doc/src/sgml/mvcc.sgml
doc/src/sgml/pgrowlocks.sgml
doc/src/sgml/ref/drop_index.sgml
doc/src/sgml/ref/reindex.sgml
doc/src/sgml/ref/vacuum.sgml

index 611b0169833b94df7878e026a278e0ce008790d1..9a18a62ce45b7a495f2f080f483773e849ca13ef 100644 (file)
@@ -1966,7 +1966,8 @@ SELECT * FROM information WHERE group_id = 2 FOR UPDATE;
    definer function.)  Also, heavy concurrent use of row share locks on the
    referenced table could pose a performance problem, especially if updates
    of it are frequent.  Another solution, practical if updates of the
-   referenced table are infrequent, is to take an exclusive lock on the
+   referenced table are infrequent, is to take an
+   <literal>ACCESS EXCLUSIVE</literal> lock on the
    referenced table when updating it, so that no concurrent transactions
    could be examining old row values.  Or one could just wait for all
    concurrent transactions to end after committing an update of the
index fee2812dd0939a43f239fe1ce9002441ceefed71..5ea8eecfff3468cb7d6b1777b652952a5e2ae150 100644 (file)
@@ -610,8 +610,9 @@ UPDATE tablename SET hstorecol = hstorecol || '';
 <programlisting>
 ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
 </programlisting>
-   The <command>ALTER TABLE</> method requires an exclusive lock on the table,
-   but does not result in bloating the table with old row versions.
+   The <command>ALTER TABLE</> method requires an <literal>ACCESS EXCLUSIVE</>
+   lock on the table, but does not result in bloating the table with old row
+   versions.
   </para>
 
  </sect2>
index 2a4b0c61c42bc85c27a113f36a9a4d6e0788d3a6..1286e7e62f84aaccdb0d5ffe3c8deba014b4c510 100644 (file)
@@ -793,8 +793,8 @@ amrestrpos (IndexScanDesc scan);
    <literal>RowExclusiveLock</> when updating the index (including plain
    <command>VACUUM</>).  Since these lock types do not conflict, the access
    method is responsible for handling any fine-grained locking it might need.
-   An exclusive lock on the index as a whole will be taken only during index
-   creation, destruction, or <command>REINDEX</>.
+   An <literal>ACCESS EXCLUSIVE</> lock on the index as a whole will be
+   taken only during index creation, destruction, or <command>REINDEX</>.
   </para>
 
   <para>
index 4b56465618d89bd82ea6cd2c59c6a1ef1321453b..3da64a2a4317f79d1850377626336f3bf8e44878 100644 (file)
     <command>DELETE</command> will continue to function normally, though you
     will not be able to modify the definition of a table with commands such as
     <command>ALTER TABLE</command> while it is being vacuumed.)
-    <command>VACUUM FULL</> requires exclusive lock on the table it is
-    working on, and therefore cannot be done in parallel with other use
-    of the table.  Generally, therefore,
+    <command>VACUUM FULL</> requires an <literal>ACCESS EXCLUSIVE</> lock
+    on the table it is working on, and therefore cannot be done in parallel
+    with other use of the table.  Generally, therefore,
     administrators should strive to use standard <command>VACUUM</> and
     avoid <command>VACUUM FULL</>.
    </para>
     or one of the table-rewriting variants of
     <xref linkend="sql-altertable">.
     These commands rewrite an entire new copy of the table and build
-    new indexes for it.  All these options require exclusive lock.  Note that
+    new indexes for it.  All these options require an
+    <literal>ACCESS EXCLUSIVE</literal> lock.  Note that
     they also temporarily use extra disk space approximately equal to the size
     of the table, since the old copies of the table and indexes can't be
     released until the new ones are complete.
index 0349cbc20e2a18067b6c86822e697bec9fc95cad..e125b878eaddf88516b775dd51abaad52fe5b416 100644 (file)
@@ -824,7 +824,8 @@ ERROR:  could not serialize access due to read/write dependencies among transact
     tables are not dropped or modified in incompatible ways while the
     command executes.  (For example, <command>TRUNCATE</> cannot safely be
     executed concurrently with other operations on the same table, so it
-    obtains an exclusive lock on the table to enforce that.)
+    obtains an <literal>ACCESS EXCLUSIVE</literal> lock on the table to
+    enforce that.)
    </para>
 
    <para>
index d912c3b12367208f221ddd54ef4d4a99b4a32417..bc492186a7775cea7a4977efb182ada699de9596 100644 (file)
@@ -90,8 +90,8 @@ pgrowlocks(text) returns setof record
   <orderedlist>
    <listitem>
     <para>
-    If the table as a whole is exclusive-locked by someone else,
-    <function>pgrowlocks</function> will be blocked.
+     If an <literal>ACCESS EXCLUSIVE</literal> lock is taken on the table,
+     <function>pgrowlocks</function> will be blocked.
     </para>
    </listitem>
    <listitem>
index a53c8cc665fa86db21c37ba046739ab9bb55d93f..c1e6a2576410580bd8b50bfc5fe7d079b6a04bf1 100644 (file)
@@ -45,9 +45,9 @@ DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] <replaceable class="PARAMETER">name</r
      <para>
       Drop the index without locking out concurrent selects, inserts, updates,
       and deletes on the index's table.  A normal <command>DROP INDEX</>
-      acquires an exclusive lock on the table, blocking other accesses until the
-      index drop can be completed.  With this option, the command instead
-      waits until conflicting transactions have completed.
+      acquires an <literal>ACCESS EXCLUSIVE</> lock on the table, blocking
+      other accesses until the index drop can be completed.  With this option,
+      the command instead waits until conflicting transactions have completed.
      </para>
      <para>
       There are several caveats to be aware of when using this option.
index 3908ade37b8fea5a7cba0fc8c45f7e077c9634d0..d075a52c3cd6d22cdaf0d2f6b2188b0e6b496818 100644 (file)
@@ -213,14 +213,15 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } <replacea
    <command>REINDEX</command> is similar to a drop and recreate of the index
    in that the index contents are rebuilt from scratch.  However, the locking
    considerations are rather different.  <command>REINDEX</> locks out writes
-   but not reads of the index's parent table.  It also takes an exclusive lock
-   on the specific index being processed, which will block reads that attempt
-   to use that index.  In contrast, <command>DROP INDEX</> momentarily takes
-   an exclusive lock on the parent table, blocking both writes and reads.  The
-   subsequent <command>CREATE INDEX</> locks out writes but not reads; since
-   the index is not there, no read will attempt to use it, meaning that there
-   will be no blocking but reads might be forced into expensive sequential
-   scans.
+   but not reads of the index's parent table.  It also takes an
+   <literal>ACCESS EXCLUSIVE</literal> lock on the specific index being processed,
+   which will block reads that attempt to use that index.  In contrast,
+   <command>DROP INDEX</command> momentarily takes an
+   <literal>ACCESS EXCLUSIVE</literal> lock on the parent table, blocking both
+   writes and reads.  The subsequent <command>CREATE INDEX</> locks out
+   writes but not reads; since the index is not there, no read will attempt to
+   use it, meaning that there will be no blocking but reads might be forced
+   into expensive sequential scans.
   </para>
 
   <para>
index 983109981738feab6dd8940a162d8f61876d5ac3..50a48a22122e65297781e5ae60f91a519321c9ef 100644 (file)
@@ -63,7 +63,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
    same table.  <command>VACUUM FULL</command> rewrites the entire contents
    of the table into a new disk file with no extra space, allowing unused
    space to be returned to the operating system.  This form is much slower and
-   requires an exclusive lock on each table while it is being processed.
+   requires an <literal>ACCESS EXCLUSIVE</literal> lock on each table while
+   it is being processed.
   </para>
 
   <para>