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.
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. 4. The method of claim 1 , wherein: a dimension of said one or more dimensions corresponds to a dimension column in said relation; said one or more predicates include a particular predicate that references said dimension column; each formula of said set of formulas has a right side and a left side; wherein each formula of said set of formulas references a second array; and the one or more criteria include, for each formula of said set of formulas: (A) for each value of the dimension referenced on the left side: (1) the value of the dimension on the right side is the same as the value of the dimension referenced on the left side, or (2) the value of the dimension on the right side depends on a value of particular cell in the second array and on a function of the value of the dimension referenced on the left side; (B) said each formula specifies an operation that does not modify the second array.