Re: Should the docs have a warning about pg_stat_reset()?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Euler Taveira <euler(at)timbira(dot)com(dot)br>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should the docs have a warning about pg_stat_reset()?
Date: 2019-04-10 18:52:23
Message-ID: 20190410185223.7kq2bn4vxu4ubg7a@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 11, 2019 at 04:14:11AM +1200, David Rowley wrote:
> On Sat, 30 Mar 2019 at 00:59, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> >
> > On Wed, Mar 27, 2019 at 7:49 PM David Rowley
> > <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> > > Yeah, analyze, not vacuum. It is a bit scary to add new ways for
> > > auto-vacuum to suddenly have a lot of work to do. When all workers
> > > are busy it can lead to neglect of other duties. It's true that there
> > > won't be much in the way of routine vacuuming work for the database
> > > the stats were just reset on, as of course, all the n_dead_tup
> > > counters were just reset. However, it could starve other databases of
> > > vacuum attention. Anti-wraparound vacuums on the current database may
> > > get neglected too.
> > >
> > > I'm not saying let's not do it, I'm just saying we need to think of
> > > what bad things could happen as a result of such a change.
> >
> > +1. I think that if we documented that pg_stat_reset() is going to
> > trigger an auto-analyze of every table in your system, we'd have some
> > people who didn't read the documentation and unleashed a storm of
> > auto-analyze activity, and other people who did read the documentation
> > and then intentionally used it to unleash a storm of auto-analyze
> > activity. Neither sounds that great.
>
> I still think we should start with a warning about pg_stat_reset().
> People are surprised by this, and these are just the ones who notice:
>
> https://www.postgresql.org/message-id/CAB_myF4sZpxNXdb-x=weLpqBDou6uE8FHtM0FVerPM-1J7phkw@mail.gmail.com
>
> I imagine there are many others just suffering from bloat due to
> auto-vacuum not knowing how many dead tuples there are in the tables.

OK, let me step back. Why are people resetting the statistics
regularly? Based on that purpose, does it make sense to clear the
stats that effect autovacuum?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-04-10 18:55:51 Re: block-level incremental backup
Previous Message Ben Simmons 2019-04-10 18:41:46 Postgres "failures" dataset for machine learning