Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5943d40

Browse files
committed
Remove erroneous claim about use of pg_locks.objid for advisory locks.
The correct information appears in the text, so just remove the statement in the table, where it did not fit nicely anyway. (Curiously, the correct info has been there much longer than the erroneous table entry.) Resolves problem noted by Daniele Varrazzo. In HEAD and 9.1, also do a bit of wordsmithing on other text on the page.
1 parent 9761ad6 commit 5943d40

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7100,6 +7100,8 @@
71007100
in the same way as in <structname>pg_description</structname> or
71017101
<structname>pg_depend</structname>). Also, the right to extend a
71027102
relation is represented as a separate lockable object.
7103+
Also, <quote>advisory</> locks can be taken on numbers that have
7104+
user-defined meanings.
71037105
</para>
71047106

71057107
<table>
@@ -7202,9 +7204,7 @@
72027204
<entry>any OID column</entry>
72037205
<entry>
72047206
OID of the lock target within its system catalog, or null if the
7205-
target is not a general database object.
7206-
For advisory locks it is used to distinguish the two key
7207-
spaces (1 for an int8 key, 2 for two int4 keys).
7207+
target is not a general database object
72087208
</entry>
72097209
</row>
72107210
<row>
@@ -7233,7 +7233,7 @@
72337233
<entry></entry>
72347234
<entry>
72357235
Process ID of the server process holding or awaiting this
7236-
lock. Null if the lock is held by a prepared transaction.
7236+
lock, or null if the lock is held by a prepared transaction
72377237
</entry>
72387238
</row>
72397239
<row>
@@ -7253,7 +7253,8 @@
72537253
<entry><structfield>fastpath</structfield></entry>
72547254
<entry><type>boolean</type></entry>
72557255
<entry></entry>
7256-
<entry>True if lock was taken via fast path, false if taken via main lock table</entry>
7256+
<entry>True if lock was taken via fast path, false if taken via main
7257+
lock table</entry>
72577258
</row>
72587259
</tbody>
72597260
</tgroup>
@@ -7292,7 +7293,8 @@
72927293

72937294
<para>
72947295
Advisory locks can be acquired on keys consisting of either a single
7295-
<type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
7296+
<type>bigint</type> value or two integer values.
7297+
A <type>bigint</type> key is displayed with its
72967298
high-order half in the <structfield>classid</> column, its low-order half
72977299
in the <structfield>objid</> column, and <structfield>objsubid</> equal
72987300
to 1. Integer keys are displayed with the first key in the
@@ -7302,34 +7304,6 @@
73027304
so the <structfield>database</> column is meaningful for an advisory lock.
73037305
</para>
73047306

7305-
<para>
7306-
The <structname>pg_locks</structname> view displays data from both the
7307-
regular lock manager and the predicate lock manager, which are
7308-
separate systems. This data is not guaranteed to be entirely consistent.
7309-
Data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
7310-
is gathered from each backend one at a time, without freezing the state of
7311-
the entire lock manager, so it is possible for locks to be taken and
7312-
released as information is gathered. Note, however, that these locks are
7313-
known not to conflict with any other lock currently in place. After
7314-
all backends have been queried for fast-path locks, the remainder of the
7315-
lock manager is locked as a unit, and a consistent snapshot of all
7316-
remaining locks is dumped as an atomic action. Once the lock manager has
7317-
been unlocked, the predicate lock manager is similarly locked and all
7318-
predicate locks are dumped as an atomic action. Thus, with the exception
7319-
of fast-path locks, each lock manager will deliver a consistent set of
7320-
results, but as we do not lock both lock managers simultaneously, it is
7321-
possible for locks to be taken or released after we interrogate the regular
7322-
lock manager and before we interrogate the predicate lock manager.
7323-
</para>
7324-
7325-
<para>
7326-
Locking the lock manger and/or predicate lock manager could have some
7327-
impact on database performance if this view is very frequently accessed.
7328-
The locks are held only for the minimum amount of time necessary to
7329-
obtain data from the lock manager, but this does not completely eliminate
7330-
the possibility of a performance impact.
7331-
</para>
7332-
73337307
<para>
73347308
<structname>pg_locks</structname> provides a global view of all locks
73357309
in the database cluster, not only those relevant to the current database.
@@ -7354,6 +7328,37 @@
73547328
but it continues to hold the locks it acquired while running.)
73557329
</para>
73567330

7331+
<para>
7332+
The <structname>pg_locks</structname> view displays data from both the
7333+
regular lock manager and the predicate lock manager, which are
7334+
separate systems; in addition, the regular lock manager subdivides its
7335+
locks into regular and <firstterm>fast-path</> locks.
7336+
This data is not guaranteed to be entirely consistent.
7337+
When the view is queried,
7338+
data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
7339+
is gathered from each backend one at a time, without freezing the state of
7340+
the entire lock manager, so it is possible for locks to be taken or
7341+
released while information is gathered. Note, however, that these locks are
7342+
known not to conflict with any other lock currently in place. After
7343+
all backends have been queried for fast-path locks, the remainder of the
7344+
regular lock manager is locked as a unit, and a consistent snapshot of all
7345+
remaining locks is collected as an atomic action. After unlocking the
7346+
regular lock manager, the predicate lock manager is similarly locked and all
7347+
predicate locks are collected as an atomic action. Thus, with the exception
7348+
of fast-path locks, each lock manager will deliver a consistent set of
7349+
results, but as we do not lock both lock managers simultaneously, it is
7350+
possible for locks to be taken or released after we interrogate the regular
7351+
lock manager and before we interrogate the predicate lock manager.
7352+
</para>
7353+
7354+
<para>
7355+
Locking the regular and/or predicate lock manager could have some
7356+
impact on database performance if this view is very frequently accessed.
7357+
The locks are held only for the minimum amount of time necessary to
7358+
obtain data from the lock managers, but this does not completely eliminate
7359+
the possibility of a performance impact.
7360+
</para>
7361+
73577362
</sect1>
73587363

73597364
<sect1 id="view-pg-prepared-statements">

0 commit comments

Comments
 (0)