shared memory. Therefore, even very lengthy query texts can
be stored successfully. However, if many long query texts are
accumulated, the external file might grow unmanageably large. As a
recovery method if that happens, <filename>pg_stat_statements</filename> may
choose to discard the query texts, whereupon all existing entries in
the <structname>pg_stat_statements</structname> view will show
null <structfield>query</structfield> fields, though the statistics associated with
each <structfield>queryid</structfield> are preserved. If this happens, consider
reducing <varname>pg_stat_statements.max</varname> to prevent
recurrences.
</para>
<para>
<structfield>plans</structfield> and <structfield>calls</structfield> aren't
always expected to match because planning and execution statistics are
updated at their respective end phase, and only for successful operations.
For example, if a statement is successfully planned but fails during
the execution phase, only its planning statistics will be updated.
If planning is skipped because a cached plan is used, only its execution
statistics will be updated.
</para>
</sect2>
<sect2 id="pgstatstatements-pg-stat-statements-info">
<title>The <structname>pg_stat_statements_info</structname> View</title>
<indexterm>
<primary>pg_stat_statements_info</primary>
</indexterm>
<para>
The statistics of the <filename>pg_stat_statements</filename> module
itself are tracked and made available via a view named
<structname>pg_stat_statements_info</structname>. This view contains
only a single row. The columns of the view are shown in
<xref linkend="pgstatstatementsinfo-columns"/>.
</para>
<table id="pgstatstatementsinfo-columns">
<title><structname>pg_stat_statements_info</structname> Columns</title>
<tgroup cols="1">
<thead>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
Column Type
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>dealloc</structfield> <type>bigint</type>
</para>
<para>
Total number of times <structname>pg_stat_statements</structname>
entries about the least-executed statements were deallocated
because more distinct statements than
<varname>pg_stat_statements.max</varname> were observed
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>stats_reset</structfield> <type>timestamp with time zone</type>
</para>
<para>
Time at which all statistics in the
<structname>pg_stat_statements</structname> view were last reset.
</para></entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="pgstatstatements-funcs">
<title>Functions</title>
<variablelist>
<varlistentry>
<term>
<function>pg_stat_statements_reset(userid Oid, dbid Oid, queryid
bigint, minmax_only boolean) returns timestamp with time zone</function>
<indexterm>
<primary>pg_stat_statements_reset</primary>
</indexterm>
</term>
<listitem>
<para>
<function>pg_stat_statements_reset</function> discards statistics
gathered so far by <filename>pg_stat_statements</filename> corresponding
to the specified <structfield>userid</structfield>, <structfield>dbid</structfield>
and <structfield>queryid</structfield>. If any of the parameters are not
specified, the default value <literal>0</literal>(invalid) is used for
each of them and the statistics that match with other parameters will be
reset. If no parameter is specified or all the specified parameters are
<literal>0</literal>(invalid), it will discard all statistics.
If all statistics in the <filename>pg_stat_statements</filename>