Re: Why is INSERT-driven autovacuuming based on pg_class.reltuples?

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Why is INSERT-driven autovacuuming based on pg_class.reltuples?
Date: 2022-01-29 03:35:51
Message-ID: CAH2-Wz=AyRW9xZ4OYbWA7+0z3+gAwhzzJB0uJWHQrzAEa-b2Ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 27, 2022 at 11:22 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> What would you suggest instead? pg_stat_all_tables.n_live_tup?

I'm not sure, except that I assume that it'll have to come from the
statistics collector, not from pg_class. I think that this bug stemmed
from the fact that vac_update_relstats() is used by both VACUUM and
ANALYZE to store information in pg_class, while both *also* use
pgstat_report_vacuum()/pgstat_report_analyze() to store closely
related information at the same point. There is rather a lot of
implicit information here. I recall a few other bugs that also seemed
related to this messiness with statistics and pg_class.

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Ladhe 2022-01-29 03:38:51 Re: refactoring basebackup.c
Previous Message Amit Kapila 2022-01-29 03:02:08 Re: Bugs in pgoutput.c