Re: updated GiST patch - Mailing list pgsql-patches

From Tom Lane
Subject Re: updated GiST patch
Date
Msg-id 19798.1116267139@sss.pgh.pa.us
Whole thread Raw
In response to Re: updated GiST patch  (Neil Conway <neilc@samurai.com>)
Responses Re: updated GiST patch
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> ... replaces two ReleaseBuffer() + ReadBuffer() pairs with
> ReleaseAndReadBuffer(). (Is this still worth doing? It seems it no
> longer saves a lock acquire/release, but perhaps it will again be a win
> in some future version of the bufmgr...)

I think there is no longer any noticeable win except in the case where
the old and new pages are actually the same.  Which is probably unlikely
to be true inside an index AM (it is a useful win for random access into
a heap for instance).  But as you say it might someday again be useful.
My advice is to combine if and only if you're not contorting the code
to do so.

> BTW, this idiom occurs a few times:

>      if (BufferIsValid(buf))
>      {
>          ReleaseBuffer(buf);
>          buf = InvalidBuffer;
>      }

I'd leave it as-is; ISTM to be more easily understandable than the
alternatives you suggest.

            regards, tom lane

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: updated GiST patch
Next
From: Bruce Momjian
Date:
Subject: Re: Exec statement logging