CPC G06F 16/24542 (2019.01) [G06F 16/2445 (2019.01)] | 18 Claims |
1. A method for deriving a set of key ranges to be used in processing a database query, the method comprising:
receiving, by a computer system, the database query to execute against a database having a database table that includes a plurality of records associated with a plurality of keys, respectively, the database query specifying a set of conditional expressions that affect which ones of the plurality of records are returned, wherein the set of conditional expressions includes an IN expression;
based on the set of conditional expressions, deriving, by the computer system, the set of key ranges by:
representing the set of conditional expressions as a set of key spaces, wherein a particular key space encompasses ones of the plurality of keys that satisfy a particular one of the set of conditional expressions, wherein the representing includes converting the IN expression into at least one OR operation involving a pair of the set of key spaces;
performing a set of logical operations on pairs of the set of key spaces to reduce a number of key spaces in the set of key spaces; and
converting the set of key spaces into the set of key ranges after performing the set of logical operations; and
executing, by the computer system, the database query according to a query plan having the set of key ranges.
|