• Tom Lane's avatar
    Improve GiST range-contained-by searches by adding a flag for empty ranges. · c66e4f13
    Tom Lane authored
    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
    c66e4f13
opr_sanity.out 48.6 KB