Multi-tiered query processing techniques for minus and intersect operators
First Claim
1. A machine-executed method comprising the steps of:
- receiving a particular query that includes a particular operator, wherein the particular operator is one of MINUS and INTERSECT;
generating a plurality of transformed queries, wherein each query of said plurality of transformed queries is generated by rewriting the particular query using a different combination of one or more transformations, and wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said particular operator;
wherein each of the transformed queries comprises a different sequence of operators, and wherein at least one of the operators in each of the different sequences of operators eliminates duplicate values;
generating cost estimates for the transformed queries in said plurality of transformed queries;
comparing the cost estimate for one of the transformed queries to the cost estimate for another of the transformed queries; and
selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates,wherein each of said steps of said method is performed by one or more computing devices.
1 Assignment
0 Petitions
Accused Products
Abstract
Various techniques are described for processing database commands that include MINUS and/or INTERSECT operators. The queries containing the MINUS and/or INTERSECT operators are transformed to create a plurality of transformed queries. Each of the transformed queries produces the same result as the original query, but does not include the MINUS and/or INTERSECT operator. To achieve the same result set as the original query, the transformed queries employ equijoins, antijoins, and/or semijoins, and duplicate elimination operations. Costs are estimated for each of the various transformed queries. Based on the cost estimates, one of the transformed queries is selected as the query that is to be executed to perform the operations specified in the original query.
-
Citations
30 Claims
-
1. A machine-executed method comprising the steps of:
-
receiving a particular query that includes a particular operator, wherein the particular operator is one of MINUS and INTERSECT; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries is generated by rewriting the particular query using a different combination of one or more transformations, and wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said particular operator; wherein each of the transformed queries comprises a different sequence of operators, and wherein at least one of the operators in each of the different sequences of operators eliminates duplicate values; generating cost estimates for the transformed queries in said plurality of transformed queries; comparing the cost estimate for one of the transformed queries to the cost estimate for another of the transformed queries; and selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates, wherein each of said steps of said method is performed by one or more computing devices. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 14)
-
-
9. A machine-executed method comprising the steps of:
-
receiving a particular query that includes a MINUS operator; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries, if executed, produces a same result as said query but does not include said MINUS operator; generating cost estimates for the transformed queries in said plurality of transformed queries; selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates; wherein each of said steps of said method is performed by one or more computing devices; and wherein the step of generating a plurality of transformed queries includes generating a transformed query in which said particular operator is removed from said particular query, and in which said same result is produced with an anti-join operator. - View Dependent Claims (10, 11, 12, 13)
-
-
15. A non-transitory machine-readable storage medium carrying one or more sequence of instructions which, when executed by one or more processors, causes the one or more processor to perform:
-
receiving a particular query that includes a particular operator, wherein the particular operator is one of MINUS and INTERSECT; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries is generated by rewriting the particular query using a different combination of one or more transformations, and wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said particular operator; wherein each of the transformed queries comprises a different sequence of operators, and wherein at least one of the operators in each of the different sequences of operators eliminates duplicate values; generating cost estimates for the transformed queries in said plurality of transformed queries; comparing the cost estimate for one of the transformed queries to the cost estimate for another of the transformed queries; and selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates. - View Dependent Claims (16, 17, 18, 19, 20, 21, 22, 28)
-
-
23. A non-transitory machine-readable storage medium carrying one or more sequences of instructions which, when executed by one or more processors, causes the one or more processors to perform:
-
receiving a particular query that includes a MINUS operator; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said MINUS operator; generating cost estimates for the transformed queries in said plurality of transformed queries; selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates; wherein each of said steps of said method is performed by one or more computing devices; and wherein the step of generating a plurality of transformed queries includes generating a transformed query in which said particular operator is removed from said particular query, and in which said same result is produced with an anti-join operator. - View Dependent Claims (24, 25, 26, 27)
-
-
29. A machine-executed method comprising the steps of:
-
receiving a particular query that includes an INTERSECT operator; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said INTERSECT operator; generating cost estimates for the transformed queries in said plurality of transformed queries; selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates, wherein each of said steps of said method is performed by one or more computing devices; wherein the particular query specifies a left-hand source and a right-hand source for said INTERSECT operator; and wherein the plurality of transformed queries includes a transformed query that is associated with an execution plan in which duplicate elimination is performed; and wherein said performance of duplicate elimination includes one of the following; performing duplicate elimination after an equijoin operation between the left-hand source and the right-hand source; performing duplicate elimination on the left-hand source prior to a semi-join between the left-hand source and the right-hand source; performing duplicate elimination on the right-hand source prior to an equijoin between the left-hand source and the right-hand source, and duplicate elimination is performed on a result set produced by the equijoin operation; and performing duplicate elimination on both the left-hand source and the right-hand source prior to an equijoin between the left-hand source and the right-hand source.
-
-
30. A non-transitory machine-readable storage medium carrying one or more sequences of instructions which, when executed by one or more processors, causes the one or more processors to perform:
-
receiving a query that includes an INTERSECT operator; generating a plurality of transformed queries, wherein each query of said plurality of transformed queries, if executed, produces a same result as said particular query but does not include said INTERSECT operator; generating cost estimates for the transformed queries in said plurality of transformed queries; selecting from said plurality of transformed queries a particular transformed query to execute based, at least in part, on the cost estimates, wherein the particular query specifies a left-hand source and a right-hand source for said INTERSECT operator; and wherein the plurality of transformed queries includes a transformed query that is associated with an execution plan in which duplicate elimination is performed; and wherein said performance of duplicate elimination includes one of the following; performing duplicate elimination after an equijoin operation between the left-hand source and the right-hand source; performing duplicate elimination on the left-hand source prior to a semi-join between the left-hand source and the right-hand source; performing duplicate elimination on the right-hand source prior to an equijoin between the left-hand source and the right-hand source, and duplicate elimination is performed on a result set produced by the equijoin operation; and performing duplicate elimination on both the left-hand source and the right-hand source prior to an equijoin between the left-hand source and the right-hand source.
-
Specification