diff options
author | Peter Geoghegan | 2023-04-03 18:31:43 +0000 |
---|---|---|
committer | Peter Geoghegan | 2023-04-03 18:31:43 +0000 |
commit | e48c817395e1cdc85dbecc4ff3c18e34983ae3f2 (patch) | |
tree | ab8c984902a3f3a41d7b4ee25067dca0254ec456 /src/include/access/nbtree.h | |
parent | a349b86603e11bad811bec111ec5330b9908e525 (diff) |
Recycle deleted nbtree pages more aggressively.
Commit 61b313e4 made nbtree consistently pass down a heaprel to low
level routines like _bt_getbuf(). Although this was primarily intended
as preparation for logical decoding on standbys, it also made it easy to
correct an old deficiency in how nbtree VACUUM determines whether or not
it's now safe to recycle deleted pages.
Pass the heaprel to GlobalVisTestFor() in nbtree routines that deal with
recycle safety. nbtree now makes less pessimistic assumptions about
recycle safety within non-catalog relations. This enhancement
complements the recycling enhancement added by commit 9dd963ae25.
nbtree remains just as pessimistic as ever when it comes to recycle
safety within indexes on catalog relations. There is no fundamental
reason why we need to treat catalog relations differently, though. The
behavioral inconsistency is a consequence of the way that nbtree uses
nextXID values to implement what Lanin and Shasha call "the drain
technique". Note in particular that it has nothing to do with whether
or not index tuples might still be required for an older MVCC snapshot.
Author: Bertrand Drouvot <[email protected]>
Discussion: https://postgr.es/m/CAH2-WzkaiDxCje0yPuH=3Uh2p1V_2pFGY==xfbZoZu7Ax_NB8g@mail.gmail.com
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r-- | src/include/access/nbtree.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 6dee3070420..953bf6586b9 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -288,7 +288,7 @@ BTPageGetDeleteXid(Page page) * well need special handling for new pages anyway. */ static inline bool -BTPageIsRecyclable(Page page) +BTPageIsRecyclable(Page page, Relation heaprel) { BTPageOpaque opaque; @@ -307,12 +307,8 @@ BTPageIsRecyclable(Page page) * For that check if the deletion XID could still be visible to * anyone. If not, then no scan that's still in progress could have * seen its downlink, and we can recycle it. - * - * XXX: If we had the heap relation we could be more aggressive about - * recycling deleted pages in non-catalog relations. For now we just - * pass NULL. That is at least simple and consistent. */ - return GlobalVisCheckRemovableFullXid(NULL, BTPageGetDeleteXid(page)); + return GlobalVisCheckRemovableFullXid(heaprel, BTPageGetDeleteXid(page)); } return false; |