Patent ID: 7945557

Claim:
A method for executing a query, comprising: with a computer including a processor: receiving the query that references one or more relational database tables; creating an outlier materialized query table storing exception data that represents a set of algebraic rules applicable to the query, wherein each of the algebraic rules represents a relationship between two columns in at least one of the one or more relational database tables; identifying a source column by searching the query for a source predicate, wherein the source predicate is a range predicate; identifying one or more candidate target columns by searching the set of algebraic rules represented by the outlier materialized query table, wherein each of the candidate target columns occurs on one side of a binding expression and the source column occurs on the other side of the binding expression, wherein the binding expression is a subtraction expression; and for each of the one or more candidate target columns, using the outlier materialized query table to determine one or more ranges each having a lower bound and an upper bound for a new range predicate that is applied to one of the relational database tables by: selecting qualified outliers from the outlier materialized query table; for each of the selected outliers, determining a range having the lower bound and the upper bound; in response to determining that there is an overlapping between ranges, merging the ranges and using the merged ranges for the new range predicate; and in response to determining that there is no overlapping between ranges, using the ranges for the new range predicate; introducing the new range predicate into the query by merging the bounds subquery into a portion of the query and adding the new range predicate to the query; and executing the portion of the query against the one or more relational database tables to retrieve data from one or more data stores.