pgsql: Refactor nbtree fastpath optimization.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Refactor nbtree fastpath optimization.
Date: 2020-03-18 21:43:30
Message-ID: E1jEgTK-0001yi-7U@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refactor nbtree fastpath optimization.

Commit 2b272734, which added the fastpath rightmost leaf page cache
insert optimization, added code to _bt_doinsert() to handle using and
invalidating the backend local block cache. It doesn't seem like a good
place to handle these low level details, though. _bt_doinsert() is
supposed to be a high level function -- it is the main entry point to
nbtinsert.c.

Restructure the code by placing handling of the rightmost block cache at
the start of a new _bt_search() shim function, _bt_search_insert(). The
new function is called from _bt_doinsert(), which uses it as a
_bt_search() variant that conveniently accepts its BTInsertState state
as an argument. _bt_doinsert() no longer needs to directly consider the
fastpath optimization.

Discussion: https://postgr.es/m/CAH2-Wzk59cxKJRd=rfbyub6-V4yWRjsOYRkUNHBLT1P1GdtCQQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/nbtree/nbtinsert.c | 285 +++++++++++++++++++---------------
1 file changed, 160 insertions(+), 125 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2020-03-18 21:59:12 pgsql: Enable BEFORE row-level triggers for partitioned tables
Previous Message Peter Eisentraut 2020-03-18 20:26:11 pgsql: Implement type regcollation