Re: Nonrandom scanned_pages distorts pg_class.reltuples set by VACUUM

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-02-17T01:16:13Z
Lists: pgsql-hackers
On Sun, Feb 13, 2022 at 1:43 PM Peter Geoghegan <pg@bowt.ie> wrote:
> This fixes the observed problem directly. It also makes the code
> robust against other similar problems that might arise in the future.
> The risk that comes from trusting that scanned_pages is a truly random
> sample (given these conditions) is generally very large, while the
> risk that comes from disbelieving it (given these same conditions) is
> vanishingly small.

Pushed.

-- 
Peter Geoghegan



Commits

  1. Avoid VACUUM reltuples distortion.

  2. Simplify lazy_scan_heap's handling of scanned pages.

  3. Avoid having vacuum set reltuples to 0 on non-empty relations in the

  4. Avoid useless truncation attempts during VACUUM.

  5. Fix VACUUM so that it always updates pg_class.reltuples/relpages.