up by writing
queries that use the same underlying statistics access functions used by
the standard views shown above. For details such as the functions' names,
consult the definitions of the standard views. (For example, in
<application>psql</application> you could issue <literal>\d+ pg_stat_activity</literal>.)
The access functions for per-database statistics take a database OID as an
argument to identify which database to report on.
The per-table and per-index functions take a table or index OID.
The functions for per-function statistics take a function OID.
Note that only tables, indexes, and functions in the current database
can be seen with these functions.
</para>
<para>
Additional functions related to the cumulative statistics system are listed
in <xref linkend="monitoring-stats-funcs-table"/>.
</para>
<table id="monitoring-stats-funcs-table">
<title>Additional Statistics Functions</title>
<tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Function
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody>
<row>
<!-- See also the entry for this in func.sgml -->
<entry role="func_table_entry"><para role="func_signature">
<function>pg_backend_pid</function> ()
<returnvalue>integer</returnvalue>
</para>
<para>
Returns the process ID of the server process attached to the current
session.
</para></entry>
</row>
<row>
<entry id="pg-stat-get-backend-io" role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_stat_get_backend_io</primary>
</indexterm>
<function>pg_stat_get_backend_io</function> ( <type>integer</type> )
<returnvalue>setof record</returnvalue>
</para>
<para>
Returns I/O statistics about the backend with the specified
process ID. The output fields are exactly the same as the ones in the
<structname>pg_stat_io</structname> view.
</para>
<para>
The function does not return I/O statistics for the checkpointer,
the background writer, the startup process and the autovacuum launcher
as they are already visible in the <structname>pg_stat_io</structname>
view and there is only one of each.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_stat_get_activity</primary>
</indexterm>
<function>pg_stat_get_activity</function> ( <type>integer</type> )
<returnvalue>setof record</returnvalue>
</para>
<para>
Returns a record of information about the backend with the specified
process ID, or one record for each active backend in the system
if <literal>NULL</literal> is specified. The fields returned are a
subset of those in the <structname>pg_stat_activity</structname> view.
</para></entry>
</row>
<row>
<entry id="pg-stat-get-backend-wal" role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_stat_get_backend_wal</primary>
</indexterm>
<function>pg_stat_get_backend_wal</function> ( <type>integer</type> )
<returnvalue>record</returnvalue>
</para>
<para>
Returns WAL statistics about the backend with the specified
process ID. The output fields are exactly the same as the ones in the
<structname>pg_stat_wal</structname> view.
</para>
<para>
The function does not return WAL statistics for the checkpointer,
the background writer, the startup process and the autovacuum launcher.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">