doc: Clarify use of ACCESS EXCLUSIVE lock in various sections
authorMichael Paquier
Thu, 1 Apr 2021 06:28:56 +0000 (15:28 +0900)
committerMichael Paquier
Thu, 1 Apr 2021 06:28:56 +0000 (15:28 +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 28331038cef40db9a53b33c30acc22802937f042..28df0b45e30cd14879bcd7fa31a8422c0f6db75f 100644 (file)
@@ -2621,7 +2621,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
+   ACCESS EXCLUSIVE 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 9cb96bd8d3a2cf97822640a33a12f650f5e22848..d046eba760d8f9db87319f1fa4aa890734298354 100644 (file)
@@ -610,7 +610,8 @@ UPDATE tablename SET hstorecol = hstorecol || '';
 
 ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
 
-   The ALTER TABLE method requires an exclusive lock on the table,
+   The ALTER TABLE method requires an
+   ACCESS EXCLUSIVE lock on the table,
    but does not result in bloating the table with old row versions.
   
 
index b156713d8b79a6b8d354a7f54b373887e3d3f736..a26ed328673833c55f110199615ad0eb64723988 100644 (file)
@@ -918,8 +918,10 @@ amparallelrescan (IndexScanDesc scan);
    RowExclusiveLock when updating the index (including plain
    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 REINDEX.
+   An ACCESS EXCLUSIVE lock on the index as a whole will be
+   taken only during index creation, destruction, or REINDEX
+   (SHARE UPDATE EXCLUSIVE is taken instead with
+   CONCURRENTLY).
   
 
   
index 43613bbe6d8b3fa12b51242b8017126eb752b8e4..38952ba83996eccd8039e3e3ede8c09ef5ec0cb1 100644 (file)
     DELETE will continue to function normally, though you
     will not be able to modify the definition of a table with commands such as
     ALTER TABLE while it is being vacuumed.)
-    VACUUM FULL requires exclusive lock on the table it is
+    VACUUM FULL requires an
+    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 VACUUM and
     or one of the table-rewriting variants of
     .
     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
+    ACCESS EXCLUSIVE 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 2d7219c2444d0dc17f59778018ce0075d1c24fb2..5cdbcfa4d6499704298907ddf791bd153783d40a 100644 (file)
@@ -826,7 +826,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, 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 ACCESS EXCLUSIVE lock on the table to
+    enforce that.)
    
 
    
index 60e13393ea6208f20b5285f58c8fc342ad642042..392d5f1f9a773368a3eef5f3a664aaefe1a53dcd 100644 (file)
@@ -97,8 +97,8 @@ pgrowlocks(text) returns setof record
   
    
     
-    If the table as a whole is exclusive-locked by someone else,
-    pgrowlocks will be blocked.
+     If an ACCESS EXCLUSIVE lock is taken on the table,
+     pgrowlocks will be blocked.
     
    
    
index b6d2c2014f28e82d6f69aa41e4eb9fb0b931a4c4..aabc85e2300201f4e747694a9b152ffb6430c932 100644 (file)
@@ -45,9 +45,10 @@ DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name
      
       Drop the index without locking out concurrent selects, inserts, updates,
       and deletes on the index's table.  A normal 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 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.
      
      
       There are several caveats to be aware of when using this option.
index 2495f8903e0baf3fa2f7d7664e62070237fa0d16..8defc0cd1bea21e210d05b61dad29ce3ecb4cc99 100644 (file)
@@ -232,14 +232,15 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR
    REINDEX 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.  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, DROP INDEX momentarily takes
-   an exclusive lock on the parent table, blocking both writes and reads.  The
-   subsequent 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
+   ACCESS EXCLUSIVE lock on the specific index being processed,
+   which will block reads that attempt to use that index.  In contrast,
+   DROP INDEX momentarily takes an
+   ACCESS EXCLUSIVE lock on the parent table, blocking both
+   writes and reads.  The subsequent 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.
   
 
   
index f9b0fb879456562263f229461c4f6f7a629d6486..c5b73b1e35e62e994e9c588e12de0c62f6ec3f0e 100644 (file)
@@ -78,7 +78,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ 
    same table.  VACUUM FULL 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 ACCESS EXCLUSIVE lock on each table while
+   it is being processed.