1. A computer-implemented method for rewriting queries, the method comprising: storing a plurality of materialized views, wherein a definition of each materialized view of the plurality of materialized views includes a set of aggregate expressions, and wherein storing said each materialized view comprises: identifying first one or more disjuncts in the set of aggregate expressions; wherein each of the set of aggregate expressions is an expression that specifies, in the definition of said each materialized view, computation of aggregated data; wherein each of the first one or more disjuncts is an expression block, included within one or more of the set of aggregate expressions, that identifies at least one column and at least one algebraic operator; and generating, based on the first one or more disjuncts, a set of disjunct trees that represent the set of aggregate expressions; storing the set of disjunct trees in computer data storage; receiving a query that requests particular aggregated data, wherein the query comprises an aggregate expression that specifies how the particular aggregated data is to be computed; identifying second one or more disjuncts in the aggregate expression; generating, based on the second one or more disjuncts, a disjunct tree that represents the aggregate expression; based on the disjunct tree and on the set of disjunct trees associated with said each materialized view of the plurality of materialized views, determining a particular materialized view from the plurality of materialized views that stores the particular aggregated data specified by the aggregate expression; and rewriting the query into an equivalent query that references the particular materialized view, wherein the equivalent query when executed would retrieve the particular aggregated data from the particular materialized view; wherein the method is performed by one or more computing devices.
1. A computer-implemented method for rewriting queries, the method comprising: storing a plurality of materialized views, wherein a definition of each materialized view of the plurality of materialized views includes a set of aggregate expressions, and wherein storing said each materialized view comprises: identifying first one or more disjuncts in the set of aggregate expressions; wherein each of the set of aggregate expressions is an expression that specifies, in the definition of said each materialized view, computation of aggregated data; wherein each of the first one or more disjuncts is an expression block, included within one or more of the set of aggregate expressions, that identifies at least one column and at least one algebraic operator; and generating, based on the first one or more disjuncts, a set of disjunct trees that represent the set of aggregate expressions; storing the set of disjunct trees in computer data storage; receiving a query that requests particular aggregated data, wherein the query comprises an aggregate expression that specifies how the particular aggregated data is to be computed; identifying second one or more disjuncts in the aggregate expression; generating, based on the second one or more disjuncts, a disjunct tree that represents the aggregate expression; based on the disjunct tree and on the set of disjunct trees associated with said each materialized view of the plurality of materialized views, determining a particular materialized view from the plurality of materialized views that stores the particular aggregated data specified by the aggregate expression; and rewriting the query into an equivalent query that references the particular materialized view, wherein the equivalent query when executed would retrieve the particular aggregated data from the particular materialized view; wherein the method is performed by one or more computing devices. 9. The method of claim 1 , wherein determining the particular materialized view from the plurality of materialized views comprises: determining whether a subset of disjuncts, from the first one or more disjuncts identified in the set of aggregate expressions included in a view definition of a candidate view from the plurality of materialized views, includes all of the second one or more disjuncts; when the subset of disjuncts includes all of the second one or more disjuncts, determining one or more multiplicative coefficients that can be used in conjunction with the subset of disjuncts to represent the aggregate expression included in the query; and selecting the candidate view as the particular materialized view when the one or more multiplicative coefficients are determined.