On Mon, Aug 8, 2022 at 8:33 AM Matthias van de Meent <boekewurm+postg...@gmail.com> wrote: > For example, if currently the measured 2% of the pages contains more > than 100% of the previous count of tuples, or with your patch the last > page contains more than 100% of the previous count of the tuples, that > new count is ignored, which seems silly considering that the vacuum > count is supposed to be authorative.
The 2% thing is conditioned on the new relpages value precisely matching the existing relpages from pg_class -- which makes it very targeted. I don't see why scanned_tuples greatly exceeding the existing reltuples from pg_class is interesting (any more interesting than the other way around). We'll always accept scanned_tuples as authoritative when VACUUM actually scans all pages, no matter what. Currently it isn't possible for VACUUM to skip pages in a table that is 32 pages or less in size. So even the new "single page" thing from the patch cannot matter there. -- Peter Geoghegan