Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Claudio Freire <klaussfreire@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Date: 2018-03-29T22:55:04Z
Lists: pgsql-hackers
Attachments
- 0004-update-index-fsm-more-often-v3.patch (text/x-diff) patch v3-0004
I wrote: > I have to go do something > else right now, but I'll take a closer look at 0004 later. OK, so after studying 0004, it seems to me that we could do it more simply as attached; that is, move the IndexFreeSpaceMapVacuum calls into btvacuumscan/spgvacuumscan, do them only if we found any recyclable pages, and drop the calls in btvacuumcleanup/spgvacuumcleanup altogether. The reason I think this is sufficient is that the scans find and record every reusable page in the index, no matter whether they were recorded before or not. Therefore, if we don't find any such pages, there's nothing useful in the FSM and no particular urgency about making its upper pages up-to-date. It's true that if the FSM is actually corrupt, leaving that to be fixed retail by searches is probably less efficient than doing an IndexFreeSpaceMapVacuum call would be --- but *only* if you assume that the problem is just in the upper pages and the leaf pages are all fine. That doesn't seem to be a case we should optimize for. I realized that the reason BRIN doesn't go through indexfsm.c is that it's actually interested in less-than-page-size free space. So it's using the right API. However, it still looks to me like we could win something there by replacing FreeSpaceMapVacuum calls with FreeSpaceMapVacuumRange calls. I've not wrapped my head around the logic completely, but it looks like there are several places where it calls FreeSpaceMapVacuum to bubble up a free-space update for just a single page. If so, that's much less efficient than it could be. regards, tom lane
Commits
-
Do index FSM vacuuming sooner.
- c79f6df75dd3 11.0 landed
-
Remove UpdateFreeSpaceMap(), use FreeSpaceMapVacuumRange() instead.
- a063baaced27 11.0 landed
-
While vacuuming a large table, update upper-level FSM data every so often.
- 851a26e26637 11.0 landed
-
Simplify autovacuum work-item implementation
- 31ae1638ce35 11.0 cited