On 2026-Nov-26, Shuntian Jiao wrote: > Álvaro Herrera <[email protected]> 于2026年11月26日周四 20:45写道: > > > Hmm, but if the number of recently dead tuples is even one less > > than the number of live tuples, the undesirable effect will > > continue to occur AFAICS? > > You're right. After testing, I believe the threshold-based approach in > v1 is not valid and is not a good solution.
So, the design that doesn't include recently-dead tuples comes from commit 7c91a0364fcf; but I wonder if there were later changes elsewhere in the code that affected the 'scanned_tuples' number we pass as input for vac_estimate_reltuples. Maybe we should make scanned_tuples include recently dead ones? (I fear that doing that might have the opposite problem though, that is, that we would overestimate the number of live tuples because of failing to subtract the recently-dead ones, so this needs careful thought and lots of different little experiments.) > One idea is to sample a few of the pages VACUUM would otherwise skip. > We could use their average live-tuple density to estimate the rest of > the skipped pages, then add the live tuples we actually counted. That > would cost some extra heap reads. Does that seem worth trying, or is > there a better way to estimate those pages with information VACUUM > already has? Doesn't sound great, since it requires more I/O, unjustified. The number of people that requests to have VACUUM do more I/O is pretty low. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "El Maquinismo fue proscrito so pena de cosquilleo hasta la muerte" (Ijon Tichy en Viajes, Stanislaw Lem)
