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

Commitffd3391

Browse files
committed
doc: Clarify use of ACCESS EXCLUSIVE lock in various sections
Some sections of the documentation used "exclusive lock" to describethat an ACCESS EXCLUSIVE lock is taken during a given operation. Thiscan be confusing to the reader as ACCESS SHARE is allowed with anEXCLUSIVE lock is used, but that would not be the case with what isdescribed on those parts of the documentation.Author: Greg RychlewskiDiscussion:https://postgr.es/m/CAKemG7VptD=7fNWckFMsMVZL_zzvgDO6v2yVmQ+ZiBfc_06kCQ@mail.gmail.comBackpatch-through: 9.6
1 parent4778826 commitffd3391

File tree

9 files changed

+31
-22
lines changed

9 files changed

+31
-22
lines changed

‎doc/src/sgml/ddl.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,8 @@ SELECT * FROM information WHERE group_id = 2 FOR UPDATE;
26302630
definer function.) Also, heavy concurrent use of row share locks on the
26312631
referenced table could pose a performance problem, especially if updates
26322632
of it are frequent. Another solution, practical if updates of the
2633-
referenced table are infrequent, is to take an exclusive lock on the
2633+
referenced table are infrequent, is to take an
2634+
<literal>ACCESS EXCLUSIVE</literal> lock on the
26342635
referenced table when updating it, so that no concurrent transactions
26352636
could be examining old row values. Or one could just wait for all
26362637
concurrent transactions to end after committing an update of the

‎doc/src/sgml/hstore.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,8 @@ UPDATE tablename SET hstorecol = hstorecol || '';
926926
<programlisting>
927927
ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
928928
</programlisting>
929-
The <command>ALTER TABLE</command> method requires an exclusive lock on the table,
929+
The <command>ALTER TABLE</command> method requires an
930+
<literal>ACCESS EXCLUSIVE</literal> lock on the table,
930931
but does not result in bloating the table with old row versions.
931932
</para>
932933

‎doc/src/sgml/indexam.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,10 @@ amparallelrescan (IndexScanDesc scan);
980980
<literal>RowExclusiveLock</literal> when updating the index (including plain
981981
<command>VACUUM</command>). Since these lock types do not conflict, the access
982982
method is responsible for handling any fine-grained locking it might need.
983-
An exclusive lock on the index as a whole will be taken only during index
984-
creation, destruction, or <command>REINDEX</command>.
983+
An <literal>ACCESS EXCLUSIVE</literal> lock on the index as a whole will be
984+
taken only during index creation, destruction, or <command>REINDEX</command>
985+
(<literal>SHARE UPDATE EXCLUSIVE</literal> is taken instead with
986+
<literal>CONCURRENTLY</literal>).
985987
</para>
986988

987989
<para>

‎doc/src/sgml/maintenance.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128
<command>DELETE</command> will continue to function normally, though you
129129
will not be able to modify the definition of a table with commands such as
130130
<command>ALTER TABLE</command> while it is being vacuumed.)
131-
<command>VACUUM FULL</command> requires exclusive lock on the table it is
131+
<command>VACUUM FULL</command> requires an
132+
<literal>ACCESS EXCLUSIVE</literal> lock on the table it is
132133
working on, and therefore cannot be done in parallel with other use
133134
of the table. Generally, therefore,
134135
administrators should strive to use standard <command>VACUUM</command> and
@@ -231,7 +232,8 @@
231232
or one of the table-rewriting variants of
232233
<link linkend="sql-altertable"><command>ALTER TABLE</command></link>.
233234
These commands rewrite an entire new copy of the table and build
234-
new indexes for it. All these options require exclusive lock. Note that
235+
new indexes for it. All these options require an
236+
<literal>ACCESS EXCLUSIVE</literal> lock. Note that
235237
they also temporarily use extra disk space approximately equal to the size
236238
of the table, since the old copies of the table and indexes can't be
237239
released until the new ones are complete.

‎doc/src/sgml/mvcc.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ ERROR: could not serialize access due to read/write dependencies among transact
826826
tables are not dropped or modified in incompatible ways while the
827827
command executes. (For example, <command>TRUNCATE</command> cannot safely be
828828
executed concurrently with other operations on the same table, so it
829-
obtains an exclusive lock on the table to enforce that.)
829+
obtains an <literal>ACCESS EXCLUSIVE</literal> lock on the table to
830+
enforce that.)
830831
</para>
831832

832833
<para>

‎doc/src/sgml/pgrowlocks.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ pgrowlocks(text) returns setof record
9797
<orderedlist>
9898
<listitem>
9999
<para>
100-
Ifthe table as a wholeisexclusive-locked by someone else,
101-
<function>pgrowlocks</function> will be blocked.
100+
Ifan <literal>ACCESS EXCLUSIVE</literal> lockistaken on the table,
101+
<function>pgrowlocks</function> will be blocked.
102102
</para>
103103
</listitem>
104104
<listitem>

‎doc/src/sgml/ref/drop_index.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] <replaceable class="parameter">name</r
4545
<para>
4646
Drop the index without locking out concurrent selects, inserts, updates,
4747
and deletes on the index's table. A normal <command>DROP INDEX</command>
48-
acquires an exclusive lock on the table, blocking other accesses until the
49-
index drop can be completed. With this option, the command instead
50-
waits until conflicting transactions have completed.
48+
acquires an <literal>ACCESS EXCLUSIVE</literal> lock on the table,
49+
blocking other accesses until the index drop can be completed. With
50+
this option, the command instead waits until conflicting transactions
51+
have completed.
5152
</para>
5253
<para>
5354
There are several caveats to be aware of when using this option.

‎doc/src/sgml/ref/reindex.sgml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,15 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { IN
282282
<command>REINDEX</command> is similar to a drop and recreate of the index
283283
in that the index contents are rebuilt from scratch. However, the locking
284284
considerations are rather different. <command>REINDEX</command> locks out writes
285-
but not reads of the index's parent table. It also takes an exclusive lock
286-
on the specific index being processed, which will block reads that attempt
287-
to use that index. In contrast, <command>DROP INDEX</command> momentarily takes
288-
an exclusive lock on the parent table, blocking both writes and reads. The
289-
subsequent <command>CREATE INDEX</command> locks out writes but not reads; since
290-
the index is not there, no read will attempt to use it, meaning that there
291-
will be no blocking but reads might be forced into expensive sequential
292-
scans.
285+
but not reads of the index's parent table. It also takes an
286+
<literal>ACCESS EXCLUSIVE</literal> lock on the specific index being processed,
287+
which will block reads that attempt to use that index. In contrast,
288+
<command>DROP INDEX</command> momentarily takes an
289+
<literal>ACCESS EXCLUSIVE</literal> lock on the parent table, blocking both
290+
writes and reads. The subsequent <command>CREATE INDEX</command> locks out
291+
writes but not reads; since the index is not there, no read will attempt to
292+
use it, meaning that there will be no blocking but reads might be forced
293+
into expensive sequential scans.
293294
</para>
294295

295296
<para>

‎doc/src/sgml/ref/vacuum.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
8383
specify parallel workers as zero. <command>VACUUM FULL</command> rewrites
8484
the entire contents of the table into a new disk file with no extra space,
8585
allowing unused space to be returned to the operating system. This form is
86-
much slower and requires anexclusivelock on each table while it is being
87-
processed.
86+
much slower and requires an<literal>ACCESS EXCLUSIVE</literal>lock on
87+
each table while it is beingprocessed.
8888
</para>
8989

9090
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp