Compile-time optimizations of queries with SQL spreadsheet
First Claim
1. A method for rewriting queries, the method comprising the computer implemented steps of:
- examining a first query that references a relation to which a second query evaluates;
wherein the second query defines an array and a first set of formulas that reference the array;
wherein the array has one or more dimensions;
wherein the first query includes one or more predicates;
wherein the second query does not include the one or more predicates;
determining whether one or more criteria for rewriting said first query or said second query are satisfied;
if said one or more criteria for rewriting said first query or said second query are satisfied, then making, based on said one or more predicates included in said first query, modifications to said second query involving one or more predicate conditions; and
generating a rewritten query based on the modifications to said second query;
wherein the steps of the method are performed by one or more computing devices.
0 Assignments
0 Petitions
Accused Products
Abstract
Described herein are optimizations and execution strategies for spreadsheet extensions to SQL. The partitioning of data, as specified in a spreadsheet clause, provides a way to parallelize the computation of spreadsheet and to provide and improve scalability. Even if the partitioning is not explicitly specified in the spreadsheet clause, the database optimizer can automatically infer the partitioning in some cases. Efficient hash based access structures on relations can be used for symbolic array addressing, enabling fast computation of formulas. When rewriting SQL statements, formulas whose results are not referenced in outer blocks can be removed from the spreadsheet clause, thus removing unnecessary computations. The predicates from other query blocks can be moved inside query blocks with spreadsheets clauses, thus considerably reducing the amount of data to be processed. Conditions for validity of this transformation are given.
-
Citations
38 Claims
-
1. A method for rewriting queries, the method comprising the computer implemented steps of:
-
examining a first query that references a relation to which a second query evaluates; wherein the second query defines an array and a first set of formulas that reference the array; wherein the array has one or more dimensions; wherein the first query includes one or more predicates; wherein the second query does not include the one or more predicates; determining whether one or more criteria for rewriting said first query or said second query are satisfied; if said one or more criteria for rewriting said first query or said second query are satisfied, then making, based on said one or more predicates included in said first query, modifications to said second query involving one or more predicate conditions; and generating a rewritten query based on the modifications to said second query; wherein the steps of the method are performed by one or more computing devices. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A method for rewriting queries, the method comprising the computer implemented steps of:
-
examining a first query that defines an array and a formula that references the array; wherein the formula has a right side and a left side; determining whether one or more criteria for rewriting said first query are satisfied; wherein said one or more criteria include that; said left side and said right side do not depend on each other, and all aggregate functions referenced on the right side can be rewritten using a window function; and if said one or more criteria for rewriting said first query are satisfied, then generating a rewritten query that uses a window function; wherein the steps of the method are performed by one or more computing devices.
-
-
13. A method for rewriting queries, the method comprising the computer implemented steps of:
-
examining a first query that references a relation to which a second query evaluates; wherein the second query defines an array and a first set of formulas that reference the array; wherein the first query includes one or more predicates; wherein the second query does not include the one or more predicates; generating a rewritten set of formulas by rewriting, based on said one or more predicates, said first set of formulas to produce said rewritten set of formulas; and generating a rewritten query based on the rewritten set of formulas; wherein the steps of the method are performed by one or more computing devices. - View Dependent Claims (14, 15, 16, 17, 18, 19)
-
-
20. A computer-readable volatile or non-volatile medium storing one or more sequences of instructions for rewriting queries, which instructions when executed by one or more processers cause performance of steps comprising:
-
examining a first query that references a relation to which a second query evaluates; wherein the second query defines an array and a first set of formulas that reference the array; wherein the array has one or more dimensions; wherein the first query includes one or more predicates; wherein the second query does not include the one or more predicates; determining whether one or more criteria for rewriting said first query or said second query are satisfied; if said one or more criteria for rewriting said first query or said second query are satisfied, then making, based on said one or more predicates included in said first query, modifications to said second query involving one or more predicate conditions; and generating a rewritten query based on the modifications to said second query. - View Dependent Claims (21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
-
-
31. A computer-readable volatile or non-volatile medium storing one or more sequences of instructions for rewriting queries, which instructions when executed by one or more processers cause performance of steps comprising:
-
examining a first query that defines an array and a formula that references the array; wherein the formula has a right side and a left side; determining whether one or more criteria for rewriting said first query are satisfied; wherein said one or more criteria include that; said left side and said right side do not depend on each other, and all aggregate functions referenced on the right side can be rewritten using a window function; and if said one or more criteria for rewriting said first query are satisfied, then generating a rewritten query that uses a window function.
-
-
32. A computer-readable volatile or non-volatile medium storing one or more sequences of instructions for rewriting queries, which instructions when executed by one or more processers cause performance of steps comprising:
-
examining a first query that references a relation to which a second query evaluates; wherein the second query defines an array and a first set of formulas that reference the array; wherein the first query includes one or more predicates; wherein the second query does not include the one or more predicates; generating a rewritten set of formulas by rewriting, based on said one or more predicates, said first set of formulas to produce said rewritten set of formulas; and generating a rewritten query based on the rewritten set of formulas. - View Dependent Claims (33, 34, 35, 36, 37, 38)
-
Specification