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

Commit6c1cfba

Browse files
committed
Fix documentation about joining pg_locks to other views.
The advice to join to pg_prepared_xacts via the transaction column was notupdated when the transaction column was replaced by virtualtransaction.Since it's not quite obvious how to do that join, give an explicit example.For consistency also give an example for the adjacent case of joining topg_stat_activity. And link-ify the view references too, just because wecan. Per bug #9840 from Alexey Bashtanov.Michael Paquier and Tom Lane
1 parent4f30487 commit6c1cfba

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7346,16 +7346,27 @@
73467346

73477347
<para>
73487348
The <structfield>pid</structfield> column can be joined to the
7349-
<structfield>pid</structfield> column of the
7350-
<structname>pg_stat_activity</structname> view to get more
7351-
information on the session holding or waiting to hold each lock.
7349+
<structfield>pid</structfield> column of the <link
7350+
linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
7351+
view to get more
7352+
information on the session holding or waiting to hold each lock,
7353+
for example
7354+
<programlisting>
7355+
SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
7356+
ON pl.pid = psa.pid;
7357+
</programlisting>
73527358
Also, if you are using prepared transactions, the
7353-
<structfield>transaction</> column can be joined to the
7354-
<structfield>transaction</structfield> column of the
7355-
<structname>pg_prepared_xacts</structname> view to get more
7356-
information on prepared transactions that hold locks.
7359+
<structfield>virtualtransaction</> column can be joined to the
7360+
<structfield>transaction</structfield> column of the <link
7361+
linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
7362+
view to get moreinformation on prepared transactions that hold locks.
73577363
(A prepared transaction can never be waiting for a lock,
73587364
but it continues to hold the locks it acquired while running.)
7365+
For example:
7366+
<programlisting>
7367+
SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
7368+
ON pl.virtualtransaction = '-1/' || ppx.transaction;
7369+
</programlisting>
73597370
</para>
73607371

73617372
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp