Thread
Commits
-
Refactor nbtree fastpath optimization.
- b029395f5e61 13.0 landed
-
Optimize btree insertions for common case of increasing values
- 2b2727343539 11.0 cited
-
nbtree: Refactor "fastpath" and _bt_search() code
Peter Geoghegan <pg@bowt.ie> — 2020-03-16T21:04:22Z
I have another refactoring patch for nbtinsert.c that is a little bigger than the commits I've pushed recently. I thought I should run it by -hackers before proceeding with commit, even though it seems like a very clear improvement to me. Attached patch creates a _bt_search() wrapper that is local to nbtinsert.c -- _bt_search_insert(). This contains all the logic needed to handle the "fastpath" rightmost leaf page caching optimization added by commit 2b272734, avoiding any direct knowledge of the optimization within the high level _bt_doinsert() function. This is more or less how things were before 2b272734. This is certainly a readability win. It's also useful to have our leaf page buffer acquired within a dedicated function that knows about the BTInsertState struct. That makes the "ownership" of the buffer less ambiguous, and provides a single reference point for other code that sets up the fastpath optimization that will now actually be used in _bt_search_insert(). -- Peter Geoghegan