Rewriting a query in terms of a summary based on aggregate computability and canonical format, and when a dimension table is on the child side of an outer join
First Claim
1. A method for processing queries, the method comprising the steps of:
- receiving a query that does not reference a particular materialized view;
said query specifying a first set of one or more aggregate functions;
said particular materialized view reflecting a second set of one or more aggregate functions;
determining whether the particular materialized view satisfies each condition in a set of conditions, the set of conditions at least including;
that each aggregate function in said first set of aggregate functions be computable from one or more corresponding aggregate functions in said second set of aggregate functions; and
that the argument to each aggregate function in said first set of aggregate functions be equivalent to the argument of the one or more corresponding aggregate functions in said second set of aggregate functions;
wherein said first set of aggregate functions includes a particular aggregation function to be applied to a target population, wherein said particular aggregation function is an aggregation function from a set of aggregation functions that consists of variance and standard deviation;
testing whether each aggregate function in said first set of aggregate functions is computable from one or more corresponding aggregate functions in said second set of aggregate functions, wherein said testing includes determining whether the particular materialized view includes a variance, sum, and count of a source population on which the target population is functionally dependent; and
if said materialized view satisfies each condition in said set of conditions, then rewriting said query to produce a rewritten query that references said materialized view and derives said results of said particular aggregation function for said target population from the variance, sum, and count of said source population.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and system are provided for processing queries, where the queries do not reference a particular materialized view. Specifically, techniques are provided for handling a query that specifies a first set of one or more aggregate functions, where the particular materialized view reflects a second set of one or more aggregate functions. Whether the query can be rewritten is determined based on the aggregate functions in the first and second sets, and the corresponding arguments. Techniques are also provided for processing a query that (1) does not reference a particular materialized view, (2) specifies a first set of one or more aggregate functions, where the particular materialized view reflects a second set of one or more aggregate functions. A technique is also provided for rewriting queries that specify an outer join that has a dimension table on the child-side of the outer join and a fact table on the parent-side of the outer join. The query is rewritten to produce a rewritten query by replacing references to the fact table in the query with references to a materialized view. The rewritten query specifies an outer join that has the dimension table on the child side and the materialized view on the parent side.
227 Citations
26 Claims
-
1. A method for processing queries, the method comprising the steps of:
-
receiving a query that does not reference a particular materialized view; said query specifying a first set of one or more aggregate functions; said particular materialized view reflecting a second set of one or more aggregate functions; determining whether the particular materialized view satisfies each condition in a set of conditions, the set of conditions at least including; that each aggregate function in said first set of aggregate functions be computable from one or more corresponding aggregate functions in said second set of aggregate functions; and that the argument to each aggregate function in said first set of aggregate functions be equivalent to the argument of the one or more corresponding aggregate functions in said second set of aggregate functions; wherein said first set of aggregate functions includes a particular aggregation function to be applied to a target population, wherein said particular aggregation function is an aggregation function from a set of aggregation functions that consists of variance and standard deviation; testing whether each aggregate function in said first set of aggregate functions is computable from one or more corresponding aggregate functions in said second set of aggregate functions, wherein said testing includes determining whether the particular materialized view includes a variance, sum, and count of a source population on which the target population is functionally dependent; and if said materialized view satisfies each condition in said set of conditions, then rewriting said query to produce a rewritten query that references said materialized view and derives said results of said particular aggregation function for said target population from the variance, sum, and count of said source population. - View Dependent Claims (2, 3)
-
-
4. A method for processing queries, the method comprising the steps of:
-
receiving a query that does not reference a particular materialized view; said query specifying a first set of one or more aggregate functions; said particular materialized view reflecting a second set of one or more aggregate functions; determining whether the particular materialized view satisfies each condition in a set of conditions, the set of conditions at least including; that each aggregate function in said first set of aggregate functions be computable from one or more corresponding aggregate functions in said second set of aggregate functions; and that the argument to each aggregate function in said first set of aggregate functions be equivalent to the argument of the one or more corresponding aggregate functions in said second set of aggregate functions; and testing whether the argument of each aggregate function in said first set of aggregate functions is equivalent to the argument of one or more corresponding aggregate functions in said second set of aggregate functions by a) creating a transformed version of the argument by transforming the argument of the aggregate function to a canonical form; b) creating transformed versions of the arguments of the one or more corresponding aggregate functions by transforming the arguments of the one or more corresponding aggregate functions to a canonical form; and c) comparing the transformed version of the argument to the transformed versions of the arguments of the one or more corresponding aggregate functions; and if said materialized view satisfies each condition in said set of conditions, then rewriting said query to produce a rewritten query that references said materialized view. - View Dependent Claims (5, 6, 7, 8, 9)
-
-
10. A method for rewriting queries, the method comprising the steps of:
-
receiving a query that specifies an outer join that has a dimension table on the child-side of the outer join and a fact table on the parent-side of the outer join; rewriting the query to produce a rewritten query by replacing references to the fact table in the query with references to a materialized view; wherein the materialized view includes a join between the dimension table and the fact table; and wherein the rewritten query specifies an outer join that has the dimension table on the child side and the materialized view on the parent side. - View Dependent Claims (11, 12, 13)
-
-
14. A computer-readable medium carrying one or more sequences of one or more instructions for processing queries, the one or more sequences of one or more instructions including instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of:
-
receiving a query that does not reference a particular materialized view; said query specifying a first set of one or more aggregate functions; said particular materialized view reflecting a second set of one or more aggregate functions; determining whether the particular materialized view satisfies each condition in a set of conditions, the set of conditions at least including; that each aggregate function in said first set of aggregate functions be computable from one or more corresponding aggregate functions in said second set of aggregate functions; and that the argument to each aggregate function in said first set of aggregate functions be equivalent to the argument of the one or more corresponding aggregate functions in said second set of aggregate functions; wherein said first set of aggregate functions includes a particular aggregation function to be applied to a target population, wherein said particular aggregation function is an aggregation function from a set of aggregation functions that consists of variance and standard deviation; testing whether each aggregate function in said first set of aggregate functions is computable from one or more corresponding aggregate functions in said second set of aggregate functions, wherein said testing includes determining whether the particular materialized view includes a variance, sum, and count of a source population on which the target population is functionally dependent; and if said materialized view satisfies each condition in said set of conditions, then rewriting said query to produce a rewritten query that references said materialized view and derives said results of said particular aggregation function for said target population from the variance, sum, and count of said source population. - View Dependent Claims (15, 16)
-
-
17. A computer-readable medium carrying one or more sequences of one or more instructions for processing queries, the one or more sequences of one or more instructions including instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of:
-
receiving a query that does not reference a particular materialized view; said query specifying a first set of one or more aggregate functions; said particular materialized view reflecting a second set of one or more aggregate functions; determining whether the particular materialized view satisfies each condition in a set of conditions, the set of conditions at least including; that each aggregate function in said first set of aggregate functions be computable from one or more corresponding aggregate functions in said second set of aggregate functions; and that the argument to each aggregate function in said first set of aggregate functions be equivalent to the argument of the one or more corresponding aggregate functions in said second set of aggregate functions; and testing whether the argument of each aggregate function in said first set of aggregate functions is equivalent to the argument of one or more corresponding aggregate functions in said second set of aggregate functions by a) creating a transformed version of the argument by transforming the argument of the aggregate function to a canonical form; b) creating transformed versions of the arguments of the one or more corresponding aggregate functions by transforming the arguments of the one or more corresponding aggregate functions to a canonical form; and c) comparing the transformed version of the argument to the transformed versions of the arguments of the one or more corresponding aggregate functions; if said materialized view satisfies each condition in said set of conditions, then rewriting said query to produce a rewritten query that references said materialized view. - View Dependent Claims (18, 19, 20, 21, 22)
-
-
23. A computer-readable medium carrying one or more sequences of one or more instructions for rewriting queries, the one or more sequences of one or more instructions including instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of:
-
receiving a query that specifies an outer join that has a dimension table on the child-side of the outer join and a fact table on the parent-side of the outer join; rewriting the query to produce a rewritten query by replacing references to the fact table in the query with references to a materialized view; wherein the materialized view includes a join between the dimension table and the fact table; and wherein the rewritten query specifies an outer join that has the dimension table on the child side and the materialized view on the parent side. - View Dependent Claims (24, 25, 26)
-
Specification