The fix is to run ANALYZE.
Discussion: https://postgr.es/m/
[email protected],
https://postgr.es/m/flat/CAKJS1f8DTbCHf9gedU0He6ARsd58E6qOhEHM1caomqj_r9MOiQ%40mail.gmail.com,
https://postgr.es/m/CAKJS1f80o98hcfSk8j%3DfdN09S7Sjz%2BvuzhEwbyQqvHJb_sZw0g%40mail.gmail.com
Backpatch-through: 10
</tgroup>
</table>
+ <warning>
+ <para>
+ Using <function>pg_stat_reset()</function> also resets counters that
+ autovacuum uses to determine when to trigger a vacuum or an analyze.
+ Resetting these counters can cause autovacuum to not perform necessary
+ work, which can cause problems such as table bloat or out-dated
+ table statistics. A database-wide <command>ANALYZE</command> is
+ recommended after the statistics have been reset.
+ </para>
+ </warning>
+
<para>
<function>pg_stat_get_activity</function>, the underlying function of
the <structname>pg_stat_activity</structname> view, returns a set of records