On 2026-Nov-26, Shuntian Jiao wrote:

> I've attached a small patch that changes only vacuumlazy.c. When a
> partial vacuum finds more recently dead tuples than live ones, removes
> no tuples, and sees no change in the number of heap pages, it uses the
> previous reltuples estimate as a lower bound. With the patch, the
> estimate stayed at 30,000 across all six runs.

+    if (vacrel->scanned_pages < rel_pages &&
+        rel_pages == vacrel->rel->rd_rel->relpages &&
+        vacrel->tuples_deleted == 0 &&
+        vacrel->recently_dead_tuples > vacrel->live_tuples)
+        vacrel->new_live_tuples = Max(vacrel->new_live_tuples,
+                                      vacrel->rel->rd_rel->reltuples);


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?

(Anyway I think it would make sense to keep this logic within
vac_estimate_reltuples rather than having half it there and the
other half out here in its caller, no?  OTOH since that is an exported
function and this is something that we will probably want to back-patch,
it's worth preserving its ABI in stable branches.)

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"


Reply via email to