Patent ID: 8799271

Claim:
A query system comprising: a database comprising a base table, the base table comprising a set of data arranged in a plurality of columns; a materialized view associated with a portion of the set of data; a materialized view query rewrite (MVQR) component to translate each of a range predicate of the materialized view for a given column of the base table and a range predicate of a query into a canonical range representation (CRR) format to generate a materialized view metadata for the given column and a query metadata, respectively, and to compare the materialized view metadata and the query metadata to determine whether the query matches the materialized view to enable the query to search the materialized view, the MVQR component being further to merge a first range associated with a first range predicate and a second range associated with a second range predicate into a third range corresponding to a single range predicate in the CRR format and comprising both the first range and the second range, the first and second range predicates being associated with at least one of the query and the materialized view and the first and second ranges comprising one of overlapping and adjacent values with respect to each other; and a query optimizer to choose from among a plurality of possible search plans for searching the base table for data associated with the range predicate of the query, the materialized view being included in the plurality of possible search plans by the query optimizer.