pgsql: Fix btree stop-at-nulls logic properly.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix btree stop-at-nulls logic properly.
Date: 2011-11-02 21:54:37
Message-ID: E1RLilZ-0007fj-7R@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix btree stop-at-nulls logic properly.

As pointed out by Naoya Anzai, my previous try at this was a few bricks
shy of a load, because I had forgotten that the initial-positioning logic
might not try to skip over nulls at the end of the index the scan will
start from. We ought to fix that, because it represents an unnecessary
inefficiency, but first let's get the scan-stop logic back to a safe
state. With this patch, we preserve the performance benefit requested
in bug #6278 for the case of scanning forward into NULLs (in a NULLS
LAST index), but the reverse case of scanning backward across NULLs
when there's no suitable initial-positioning qual is still inefficient.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/882368e854b6f094f94aca292f390bbd9f44359b

Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 108 ++++++++++++++++++++--------
src/test/regress/expected/create_index.out | 54 ++++++++++++++
src/test/regress/sql/create_index.sql | 24 ++++++
3 files changed, 156 insertions(+), 30 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2011-11-02 23:12:24 Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
Previous Message Simon Riggs 2011-11-02 19:48:43 Re: Re: [COMMITTERS] pgsql: Reduce checkpoints and WAL traffic on low activity database serv