aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-04-03 14:18:31 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-04-03 14:18:31 -0400
commit6c1cfbacb9f92454a91d2898da84772fc6eeddd7 (patch)
treea22c9febb8b0bb565266105286eba8ee2f76fe99
parent4f304875356bd92f5ed06fe751b985bbfd5b7d66 (diff)
downloadpostgresql-6c1cfbacb9f92454a91d2898da84772fc6eeddd7.tar.gz
postgresql-6c1cfbacb9f92454a91d2898da84772fc6eeddd7.zip
Fix documentation about joining pg_locks to other views.
The advice to join to pg_prepared_xacts via the transaction column was not updated 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 to pg_stat_activity. And link-ify the view references too, just because we can. Per bug #9840 from Alexey Bashtanov. Michael Paquier and Tom Lane
-rw-r--r--doc/src/sgml/catalogs.sgml25
1 files changed, 18 insertions, 7 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 945f5754cef..9a9b3c4f5a3 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7346,16 +7346,27 @@
<para>
The <structfield>pid</structfield> column can be joined to the
- <structfield>pid</structfield> column of the
- <structname>pg_stat_activity</structname> view to get more
- information on the session holding or waiting to hold each lock.
+ <structfield>pid</structfield> column of the <link
+ linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
+ view to get more
+ information on the session holding or waiting to hold each lock,
+ for example
+<programlisting>
+SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
+ ON pl.pid = psa.pid;
+</programlisting>
Also, if you are using prepared transactions, the
- <structfield>transaction</> column can be joined to the
- <structfield>transaction</structfield> column of the
- <structname>pg_prepared_xacts</structname> view to get more
- information on prepared transactions that hold locks.
+ <structfield>virtualtransaction</> column can be joined to the
+ <structfield>transaction</structfield> column of the <link
+ linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
+ view to get more information on prepared transactions that hold locks.
(A prepared transaction can never be waiting for a lock,
but it continues to hold the locks it acquired while running.)
+ For example:
+<programlisting>
+SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
+ ON pl.virtualtransaction = '-1/' || ppx.transaction;
+</programlisting>
</para>
<para>