Re: Emit fewer vacuum records by reaping removable tuples during pruning
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Melanie Plageman <melanieplageman@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, Peter Geoghegan <pg@bowt.ie>, Pg Hackers <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>
Date: 2024-01-05T13:59:41Z
Lists: pgsql-hackers
On Thu, Jan 4, 2024 at 6:03 PM Melanie Plageman <melanieplageman@gmail.com> wrote: > When a single page is being processed, page pruning happens in > heap_page_prune(). Freezing, dead items recording, and visibility > checks happen in lazy_scan_prune(). Visibility map updates and > freespace map updates happen back in lazy_scan_heap(). Except, if the > table has no indexes, in which case, lazy_scan_heap() also invokes > lazy_vacuum_heap_page() to set dead line pointers unused and do > another separate visibility check and VM update. I maintain that all > page-level processing should be done in the page-level processing > functions (like lazy_scan_prune()). And lazy_scan_heap() shouldn't be > directly responsible for special case page-level processing. But you can just as easily turn this argument on its head, can't you? In general, except for HOT tuples, line pointers are marked dead by pruning and unused by vacuum. Here you want to turn it on its head and make pruning do what would normally be vacuum's responsibility. I mean, that's not to say that your argument is "wrong" ... but what I just said really is how I think about it, too. > > Also, I find "pronto_reap" to be a poor choice of name. "pronto" is an > > informal word that seems to have no advantage over something like > > "immediate" or "now," and I don't think "reap" has a precise, > > universally-understood meaning. You could call this "mark_unused_now" > > or "immediately_mark_unused" or something and it would be far more > > self-documenting, IMHO. > > Yes, I see how pronto is unnecessarily informal. If there are no cases > other than when the table has no indexes that we would consider > immediately marking LPs unused, then perhaps it is better to call it > "no_indexes" (per andres' suggestion)? wfm. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Combine FSM updates for prune and no-prune cases.
- 5eafacd2797d 17.0 landed
-
Remove LVPagePruneState.
- e313a6113704 17.0 landed
-
Move VM update code from lazy_scan_heap() to lazy_scan_prune().
- cb970240f13d 17.0 landed
-
Optimize vacuuming of relations with no indexes.
- c120550edb86 17.0 landed
-
Be more consistent about whether to update the FSM while vacuuming.
- 45d395cd75ff 17.0 landed
-
Remove hastup from LVPagePruneState.
- e2d5b3b9b643 17.0 landed
-
Use scanned_pages to decide when to failsafe check.
- 07eef53955ea 16.0 cited
-
Simplify lazy_scan_heap's handling of scanned pages.
- 44fa84881fff 15.0 cited
-
While vacuuming a large table, update upper-level FSM data every so often.
- 851a26e26637 11.0 cited