ANALYZE counts LP_DEAD line pointers as n_dead_tup - Mailing list pgsql-hackers

From Masahiko Sawada
Subject ANALYZE counts LP_DEAD line pointers as n_dead_tup
Date
Msg-id CAD21AoBwkgvxiR13Atr=49TFf_thvZttzOsVZp-eRu8Bz+u9dg@mail.gmail.com
Whole thread Raw
Responses Re: ANALYZE counts LP_DEAD line pointers as n_dead_tup  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Hi all,

If we create a table with vacuum_index_cleanup = off or execute VACUUM
with INDEX_CLEANUP = off, vacuum updates pg_stat_all_tables.n_dead_tup
to the number of HEAPTUPLE_RECENTLY_DEAD tuples. Whereas analyze
updates it to the sum of the number of HEAPTUPLE_DEAD/RECENTLY_DEAD
tuples and LP_DEAD line pointers. So if the table has many LP_DEAD
line pointers due to skipping index cleanup, autovacuum is triggered
every time after analyze/autoanalyze. This issue seems to happen also
on back branches, probably from 12 where INDEX_CLEANUP option was
introduced.

I think we can have heapam_scan_analyze_next_tuple() not count LP_DEAD
line pointer as lazy_scan_prune() does. Attached the patch for that.

Regards,

-- 
Masahiko Sawada
EDB:  https://www.enterprisedb.com/

Attachment

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Can a child process detect postmaster death when in pg_usleep?
Next
From: "Mead, Scott"
Date:
Subject: Re: [BUG] Autovacuum not dynamically decreasing cost_limit and cost_delay