摘要 |
In one embodiment, a plurality of materialized views is stored, where each view includes a set of aggregate expressions. Storing each materialized view comprises identifying one or more disjuncts in the set of aggregate expressions, generating a set of disjunct trees that represent the set of aggregate expressions, and storing the set of disjunct trees. When a query that requests aggregated data is received, one or more disjuncts are identified in an aggregate expression specified in the query. A disjunct tree for the disjuncts in the query is generated. Based on the disjunct tree for the query and on the set of disjunct trees for each materialized view, a particular materialized view is determined from the plurality of materialized views. The query is rewritten into an equivalent query that references the particular materialized view, where the equivalent query would retrieve the requested aggregated data from the particular materialized view.
|