Patent ID: 8775414

Claim:
A computer system for executing a query plan against a database, the computer system comprising: a processor that is adapted to execute stored instructions; a cache memory comprising a balanced tree representing an index of a database table; and a memory device that stores instructions, the memory device comprising: computer-implemented code adapted to access a first subset of rows of the database table using a direct access method, wherein the direct access method uses a first number of columns of the index, wherein the query plan comprises the direct access method, and wherein the direct access method uses the balanced tree, the computer-implemented code comprising computer-implemented code adapted to: scan one or more rows of the first subset; and determine whether a predicate is true for the scanned rows, wherein the query plan comprises the predicate; computer-implemented code adapted to determine a processing cost of accessing the first subset of rows, wherein the processing cost comprises a number of consecutive rows in the scanned rows for which the predicate is false; computer-implemented code adapted to modify the direct access method in response to determining that the processing cost exceeds a specified threshold; computer-implemented code adapted to access a second subset of rows of the database table using the modified direct access method, wherein the modified direct access method uses a second number of columns of the index, and wherein the first number of columns is either: greater than the second number of columns; or less than the second number of columns; and computer-implemented code adapted to maintain storage of the balanced tree in the cache memory.