pgsql: Do index FSM vacuuming sooner.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Do index FSM vacuuming sooner.
Date: 2018-03-30 15:48:33
Message-ID: E1f1wGX-0005Dp-4O@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Do index FSM vacuuming sooner.

In btree and SP-GiST indexes, move the responsibility for calling
IndexFreeSpaceMapVacuum from the vacuumcleanup phase to the bulkdelete
phase, and do it if and only if we found some pages that could be put into
FSM. As in commit 851a26e26, the idea is to make free pages visible to FSM
searchers sooner when vacuuming very large tables (large enough to need
multiple bulkdelete scans). This adds more redundant work than that commit
did, since we have to scan the entire index FSM each time rather than being
able to localize what needs to be updated; but it still seems worthwhile.
However, we can buy something back by not touching the FSM at all when
there are no pages that can be put in it. That will result in slower
recovery from corrupt upper FSM pages in such a scenario, but it doesn't
seem like that's a case we need to optimize for.

Hash indexes don't use FSM at all. GIN, GiST, and bloom indexes update
FSM during the vacuumcleanup phase not bulkdelete, so that doing something
comparable to this would be a much more invasive change, and it's not clear
it's worth it. BRIN indexes do things sufficiently differently that this
change doesn't apply to them, either.

Claudio Freire, reviewed by Masahiko Sawada and Jing Wang, some additional
tweaks by me

Discussion: https://postgr.es/m/CAGTBQpYR0uJCNTt3M5GOzBRHo+-GccNO1nCaQ8yEJmZKSW5q1A@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c79f6df75dd381dbc387326f8155402992524124

Modified Files
--------------
src/backend/access/nbtree/nbtree.c | 18 +++++++++++++++---
src/backend/access/spgist/spgvacuum.c | 23 +++++++++++++++++------
2 files changed, 32 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2018-03-30 17:34:27 pgsql: docs: add parameter with brackets around varbit()
Previous Message Robert Haas 2018-03-30 15:45:43 Re: pgsql: Rewrite the code that applies scan/join targets to paths.