pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Optimize btree insertions for common case of increasing values
Date: Mon, 26 Mar 2018 12:10:13 +0000
Message-ID: <E1f0Qx3-0004Z5-KN@gemulon.postgresql.org> (raw)

Optimize btree insertions for common case of increasing values

Remember the last page of an index insert if it's the rightmost leaf
page. If the next entry belongs on and can fit in the remembered page,
insert the new entry there as long as we can get a lock on the page.
Otherwise, fall back on the more expensive method of searching for
the right place to insert the entry.

This provides a performance improvement for the common case where an
index entry is for monotonically increasing or nearly monotonically
increasing value such as an identity field or a current timestamp.

Pavan Deolasee
Reviewed by Claudio Freire, Simon Riggs and Peter Geoghegan

Discussion: https://postgr.es/m/CABOikdM9DrupjyKZZFM5k8-0RCDs1wk6JzEkg7UgSW6QzOwMZw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2b27273435392d1606f0ffc95d73a439a457f08e

Modified Files
--------------
src/backend/access/nbtree/nbtinsert.c  | 138 +++++++++++++++---
src/test/regress/expected/indexing.out | 249 +++++++++++++++++++++++++++++++++
src/test/regress/sql/indexing.sql      | 116 +++++++++++++++
3 files changed, 484 insertions(+), 19 deletions(-)



view thread (19+ messages)  latest in thread

Message-ID: <E1f0Qx3-0004Z5-KN@gemulon.postgresql.org>
Permalink:  ../E1f0Qx3-0004Z5-KN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1f0Qx3-0004Z5-KN@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net
  Subject: Re: pgsql: Optimize btree insertions for common case of increasing values
  In-Reply-To: <E1f0Qx3-0004Z5-KN@gemulon.postgresql.org>
  References: <E1f0Qx3-0004Z5-KN@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox