From: | Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Reduce path length for locking leaf B-tree pages during insertio |
Date: | 2018-07-27 21:37:59 |
Message-ID: | E1fjAQx-0002N6-Bc@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Reduce path length for locking leaf B-tree pages during insertion
In our B-tree implementation appropriate leaf page for new tuple
insertion is acquired using _bt_search() function. This function always
returns leaf page locked in shared mode. In order to obtain exclusive
lock, caller have to relock the page.
This commit makes _bt_search() function lock leaf page immediately in
exclusive mode when needed. That removes unnecessary relock and, in
turn reduces lock contention for B-tree leaf pages. Our experiments
on multi-core systems showed acceleration up to 4.5 times in corner
case.
Discussion: https://postgr.es/m/CAPpHfduAMDFMNYTCN7VMBsFg_hsf0GqiqXnt%2BbSeaJworwFoig%40mail.gmail.com
Author: Alexander Korotkov
Reviewed-by: Yoshikazu Imai, Simon Riggs, Peter Geoghegan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d2086b08b023c0749a53d617ff3fe0f052646254
Modified Files
--------------
src/backend/access/nbtree/nbtinsert.c | 19 ++++-----------
src/backend/access/nbtree/nbtsearch.c | 44 +++++++++++++++++++++++++++++------
2 files changed, 41 insertions(+), 22 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2018-07-28 15:36:07 | pgsql: pgtest: grab possible warnings from install.log |
Previous Message | Alvaro Herrera | 2018-07-27 14:58:30 | pgsql: Fix grammar in README.tuplock |