• Peter Geoghegan's avatar
    Document LP_DEAD accounting issues in VACUUM. · 7136bf34
    Peter Geoghegan authored
    Document VACUUM's soft assumption that any LP_DEAD items encountered
    during pruning will become LP_UNUSED items before VACUUM finishes up.
    This is integral to the accounting used by VACUUM to generate its final
    report on the table to the stats collector.  It also affects how VACUUM
    determines which heap pages are truncatable.  In both cases VACUUM is
    concerned with the likely contents of the page in the near future, not
    the current contents of the page.
    
    This state of affairs created the false impression that VACUUM's dead
    tuple accounting had significant difference with similar accounting used
    during ANALYZE.  There were and are no substantive differences, at least
    when the soft assumption completely works out.  This is far clearer now.
    
    Also document cases where things don't quite work out for VACUUM's dead
    tuple accounting.  It's possible that a significant number of LP_DEAD
    items will be left behind by VACUUM, and won't be recorded as remaining
    dead tuples in VACUUM's statistics collector report.  This behavior
    dates back to commit a96c41fe, which taught VACUUM to run without index
    and heap vacuuming at the user's request.  The failsafe mechanism added
    to VACUUM more recently by commit 1e55e7d1 takes the same approach to
    dead tuple accounting.
    Reported-By: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
    Discussion: https://postgr.es/m/CAH2-Wz=Jmtu18PrsYq3EvvZJGOmZqSO2u3bvKpx9xJa5uhNp=Q@mail.gmail.com
    7136bf34
vacuumlazy.c 137 KB