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

Commit2186533

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 parent64e381a commit2186533

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
@@ -7711,16 +7711,27 @@
77117711

77127712
<para>
77137713
The <structfield>pid</structfield> column can be joined to the
7714-
<structfield>pid</structfield> column of the
7715-
<structname>pg_stat_activity</structname> view to get more
7716-
information on the session holding or waiting to hold each lock.
7714+
<structfield>pid</structfield> column of the <link
7715+
linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
7716+
view to get more
7717+
information on the session holding or waiting to hold each lock,
7718+
for example
7719+
<programlisting>
7720+
SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
7721+
ON pl.pid = psa.pid;
7722+
</programlisting>
77177723
Also, if you are using prepared transactions, the
7718-
<structfield>transaction</> column can be joined to the
7719-
<structfield>transaction</structfield> column of the
7720-
<structname>pg_prepared_xacts</structname> view to get more
7721-
information on prepared transactions that hold locks.
7724+
<structfield>virtualtransaction</> column can be joined to the
7725+
<structfield>transaction</structfield> column of the <link
7726+
linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
7727+
view to get moreinformation on prepared transactions that hold locks.
77227728
(A prepared transaction can never be waiting for a lock,
77237729
but it continues to hold the locks it acquired while running.)
7730+
For example:
7731+
<programlisting>
7732+
SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
7733+
ON pl.virtualtransaction = '-1/' || ppx.transaction;
7734+
</programlisting>
77247735
</para>
77257736

77267737
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp