1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Make the pg_stat_activity view call a SRF (pg_stat_get_activity())

instead of calling a bunch of individual functions.

This function can also be called directly, taking a PID as an argument, to
return only the data for a single PID.
This commit is contained in:
Magnus Hagander
2008-05-07 14:41:56 +00:00
parent 8008988be3
commit 0423de4d30
6 changed files with 271 additions and 31 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.57 2008/04/10 13:34:33 alvherre Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.58 2008/05/07 14:41:55 mha Exp $ -->
<chapter id="monitoring">
<title>Monitoring Database Activity</title>
@ -654,15 +654,6 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
</entry>
</row>
<row>
<entry><literal><function>pg_stat_get_backend_idset</function>()</literal></entry>
<entry><type>setof integer</type></entry>
<entry>
Set of currently active server process numbers (from 1 to the
number of active server processes). See usage example in the text
</entry>
</row>
<row>
<!-- See also the entry for this in func.sgml -->
<entry><literal><function>pg_backend_pid</function>()</literal></entry>
@ -672,6 +663,26 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
</entry>
</row>
<row>
<entry><literal><function>pg_stat_get_activity</function>(<type>integer</type>)</literal></entry>
<entry><type>setof record</type></entry>
<entry>
Returns a record of information about the backend with the specified pid, or
one record for each active backend in the system if <symbol>NULL</symbol> is
specified. The fields returned are the same as in the
<structname>pg_stat_activity</structname> view
</entry>
</row>
<row>
<entry><literal><function>pg_stat_get_backend_idset</function>()</literal></entry>
<entry><type>setof integer</type></entry>
<entry>
Set of currently active server process numbers (from 1 to the
number of active server processes). See usage example in the text
</entry>
</row>
<row>
<entry><literal><function>pg_stat_get_backend_pid</function>(<type>integer</type>)</literal></entry>
<entry><type>integer</type></entry>
@ -869,6 +880,8 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
</note>
<para>
All functions to access information about backends are indexed by backend id
number, except <function>pg_stat_get_activity</function> which is indexed by PID.
The function <function>pg_stat_get_backend_idset</function> provides
a convenient way to generate one row for each active server process. For
example, to show the <acronym>PID</>s and current queries of all server processes: