Home Explore Blog CI



postgresql

57th chunk of `doc/src/sgml/monitoring.sgml`
fb673c9cd070f2ef0e1e7a79b6f12c165392568eee5a671e0000000100000fc8
 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">
        <indexterm>
         <primary>pg_stat_get_snapshot_timestamp</primary>
        </indexterm>
        <function>pg_stat_get_snapshot_timestamp</function> ()
        <returnvalue>timestamp with time zone</returnvalue>
       </para>
       <para>
        Returns the timestamp of the current statistics snapshot, or NULL if
        no statistics snapshot has been taken. A snapshot is taken the first
        time cumulative statistics are accessed in a transaction if
        <varname>stats_fetch_consistency</varname> is set to
        <literal>snapshot</literal>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>pg_stat_get_xact_blocks_fetched</primary>
        </indexterm>
        <function>pg_stat_get_xact_blocks_fetched</function> ( <type>oid</type> )
        <returnvalue>bigint</returnvalue>
       </para>
       <para>
        Returns the number of block read requests for table or index, in the
        current transaction. This number minus
        <function>pg_stat_get_xact_blocks_hit</function> gives the number of
        kernel <function>read()</function> calls; the number of actual
        physical reads is usually lower due to kernel-level buffering.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>pg_stat_get_xact_blocks_hit</primary>
        </indexterm>
        <function>pg_stat_get_xact_blocks_hit</function> ( <type>oid</type> )
        <returnvalue>bigint</returnvalue>
       </para>
       <para>
        Returns the number of block read requests for table or index, in the
        current transaction, found in cache (not triggering kernel
        <function>read()</function> calls).
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>pg_stat_clear_snapshot</primary>
        </indexterm>
        <function>pg_stat_clear_snapshot</function> ()
        <returnvalue>void</returnvalue>
       </para>
       <para>
        Discards the current statistics snapshot or cached information.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>pg_stat_reset</primary>
        </indexterm>
        <function>pg_stat_reset</function> ()
        <returnvalue>void</returnvalue>
       </para>
       <para>
        Resets all statistics counters for the current database to zero.
       </para>
       <para>
        This function is restricted to superusers by default, but other users
        can be granted EXECUTE to run the function.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>pg_stat_reset_shared</primary>
        </indexterm>
        <function>pg_stat_reset_shared</function>

Title: PostgreSQL Statistics Functions (Continued)
Summary
This section continues detailing PostgreSQL statistics functions, including `pg_stat_get_snapshot_timestamp` (returns snapshot timestamp), `pg_stat_get_xact_blocks_fetched` (counts transaction block read requests), `pg_stat_get_xact_blocks_hit` (counts transaction block read requests found in cache), `pg_stat_clear_snapshot` (discards current snapshot), and `pg_stat_reset` (resets statistics counters for the current database).