Patent ID: 7379933

Claim:
A computer-implemented method for query rewriting, the method comprising the steps of: receiving a first query that defines a plurality of groupings and an aggregation operation based on information in one or more base tables; wherein a group-by clause in said first query defines said plurality of groupings; wherein said first query does not refer to a particular summary table; wherein said plurality of groupings contains at least one grouping that cannot be derived from any grouping contained in said particular summary table; representing said first query as a second query that defines a UNION ALL operation between a plurality of subqueries, wherein each subquery of said plurality of subqueries contains a grouping of said plurality of groupings; and transforming said second query into a third query that references a plurality of summary tables, wherein said plurality of summary tables includes said particular summary table; wherein the third query requests the same information as the first query.