Re: Faster inserts with mostly-monotonically increasing values

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(dot)riggs(at)2ndquadrant(dot)com>
Subject: Re: Faster inserts with mostly-monotonically increasing values
Date: 2018-03-06 00:48:50
Message-ID: CAGTBQpaYXRVmp+x+FZ+hABWe6AKCq7X06zj-ikktk1_jtY70nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 5, 2018 at 9:37 PM, Claudio Freire <klaussfreire(at)gmail(dot)com> wrote:
> Assuming the rightmost page is the first page the value could be on,
> it already does get an exclusive buffer lock.

That made me check, and:

+ /*
+ * Acquire exclusive lock on the buffer before doing any checks. This
+ * ensures that the index state cannot change, as far as the rightmost
+ * part of the index is concerned.
+ */
+ LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);

BTree code uses BT_READ and BT_WRITE instead, so that should be:

LockBuffer(buf, BT_WRITE)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-06 00:49:06 Re: [COMMITTERS] pgsql: Fix inadequate locking during get_rel_oids().
Previous Message Michael Paquier 2018-03-06 00:47:47 Re: Cache lookup errors with functions manipulation object addresses