Should the docs have a warning about pg_stat_reset()? - Mailing list pgsql-hackers

From David Rowley
Subject Should the docs have a warning about pg_stat_reset()?
Date
Msg-id CAKJS1f8DTbCHf9gedU0He6ARsd58E6qOhEHM1caomqj_r9MOiQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
As I mentioned in [1], I've had a few cases recently about auto-vacuum
not working. On the other thread, it was all about auto-vacuum being
configured to run too slowly.  The other culprit for auto-vacuum not
working is when people periodically use pg_stat_reset().

The problem with pg_stat_reset() is that it zeros n_dead_tup and
n_mod_since_analyze.  If say a user resets the stats on a monthly
basis then this can mean that tables that normally receive an
auto-vacuum any less frequently than once per month could never
receive an auto-vacuum... at least not until an anti-wraparound vacuum
gets hold of it.

The best I can think to do to try and avoid this is to put a giant
WARNING in the docs about either not using it or to at least run
ANALYZE after using it.

Does anyone else think this is a problem worth trying to solve?

[1] https://www.postgresql.org/message-id/CAKJS1f_YbXC2qTMPyCbmsPiKvZYwpuQNQMohiRXLj1r=8_rYvw@mail.gmail.com

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: Problems with plan estimates in postgres_fdw
Next
From: Tom Lane
Date:
Subject: Re: pg_upgrade: Pass -j down to vacuumdb