Home Explore Blog CI



postgresql

58th chunk of `doc/src/sgml/monitoring.sgml`
5c9b60bdea111a4c0bc984f602e5625536fc035d857e06500000000100000fb1
 </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> ( [ <parameter>target</parameter> <type>text</type> <literal>DEFAULT</literal> <literal>NULL</literal> ] )
        <returnvalue>void</returnvalue>
       </para>
       <para>
        Resets some cluster-wide statistics counters to zero, depending on the
        argument. <parameter>target</parameter> can be:
       <itemizedlist>
        <listitem>
         <para>
          <literal>archiver</literal>: Reset all the counters shown in the
          <structname>pg_stat_archiver</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
           <literal>bgwriter</literal>: Reset all the counters shown in the
           <structname>pg_stat_bgwriter</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>checkpointer</literal>: Reset all the counters shown in the
          <structname>pg_stat_checkpointer</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>io</literal>: Reset all the counters shown in the
          <structname>pg_stat_io</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>recovery_prefetch</literal>: Reset all the counters shown in
          the <structname>pg_stat_recovery_prefetch</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>slru</literal>: Reset all the counters shown in the
          <structname>pg_stat_slru</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>wal</literal>: Reset all the counters shown in the
          <structname>pg_stat_wal</structname> view.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>NULL</literal> or not specified: All the counters from the
          views listed above are reset.
         </para>
        </listitem>
       </itemizedlist>
       </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_single_table_counters</primary>
        </indexterm>
        <function>pg_stat_reset_single_table_counters</function> ( <type>oid</type> )
        <returnvalue>void</returnvalue>
       </para>
       <para>
        Resets statistics for a single table or index in the current database
        or shared across all databases in the cluster 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_backend_stats</primary>

Title: PostgreSQL Statistics Functions (Continued): Resetting Statistics
Summary
This section details functions for resetting statistics in PostgreSQL. `pg_stat_clear_snapshot` discards the current statistics snapshot. `pg_stat_reset` resets all statistics counters for the current database (superuser restricted, but EXECUTE permission can be granted). `pg_stat_reset_shared` resets cluster-wide statistics counters like archiver, bgwriter, checkpointer, io, recovery_prefetch, slru, or wal (also superuser restricted). `pg_stat_reset_single_table_counters` resets statistics for a single table or index (superuser restricted).