pgsql: Improve GiST range-contained-by searches by adding a flag for em

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve GiST range-contained-by searches by adding a flag for em
Date: 2011-11-27 21:51:39
Message-ID: E1RUmdP-00046o-VZ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve GiST range-contained-by searches by adding a flag for empty ranges.

In the original implementation, a range-contained-by search had to scan
the entire index because an empty range could be lurking anywhere.
Improve that by adding a flag to upper GiST entries that says whether the
represented subtree contains any empty ranges.

Also, make a simple mod to the penalty function to discourage empty ranges
from getting pushed into subtrees without any. This needs more work, and
the picksplit function should be taught about it too, but that code can be
improved without causing an on-disk compatibility break; so we'll leave it
for another day.

Since we're breaking on-disk compatibility of range values anyway, I took
the opportunity to reorganize the range flags bits; the unused
RANGE_xB_NULL bits are now adjacent, which might open the door for using
them in some other way later.

In passing, remove the GiST range opclass entry for <>, which doesn't seem
like it can really be indexed usefully.

Alexander Korotkov, with some editorializing by Tom

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c66e4f138b04d749a713ad075e16f3d60975f5ad

Modified Files
--------------
src/backend/utils/adt/rangetypes.c | 18 ++++
src/backend/utils/adt/rangetypes_gist.c | 129 ++++++++++++++++++++----------
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amop.h | 1 -
src/include/utils/rangetypes.h | 21 +++--
src/test/regress/expected/opr_sanity.out | 3 +-
6 files changed, 118 insertions(+), 56 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-11-27 22:13:03 pgsql: Use IEEE infinity, not 1e10, for null-and-not-null case in gistp
Previous Message Peter Eisentraut 2011-11-27 20:46:29 pgsql: Add pg_upgrade test suite