We observed unnecessary operations comparing a range performed in ascending order versus descending order. When the key values that satisfy a range are contiguous, the range logic can stop searching whenever an internal get next key operation finds a key that does not satisfy the range criteria. The descending range logic, PRVRNG()/PRVVRNG(), did not take advantage of this optimization, and made unnecessary calls to low-level key routines.
This modification applies the optimization to the descending order range routines. The key values satisfying a range will be contiguous if:
or
Trailing segments, if any, that have no range criteria do not affect whether or not the keys satisfying the range criteria are contiguous.