Join factorization of union/union all queries
First Claim
Patent Images
1. A computer implemented method, comprising:
- transforming a base query to generate a transformed query;
wherein the base query includes a union between each base branch of a plurality of base branches;
wherein each of two or more base branches of said plurality of base branches joins a set of tables;
wherein the sets of tables of the two or more base branches of the plurality of base branches include a common table set shared by all the sets of tables, said common table set including a common table;
wherein each of the two or more base branches of the plurality of base branches include a respective set of tables that does not include said common table set;
wherein the step of transforming the base query includes replacing the plurality of base branches with a first group branch that joins the common table and an inline view, the inline view comprising a union between a plurality of respective branches, wherein the plurality of respective branches includes, for each base branch of said plurality of base branches, a FROM list that;
references the respective set of tables, anddoes not reference the common table; and
wherein the method is performed by one or more computing devices.
1 Assignment
0 Petitions
Accused Products
Abstract
Under a type of query transformation referred to herein as join factorization, the branches of an UNION/UNION ALL query that join a common table are combined to reduce accesses to the common table. The transformation can be expressed as (T1 join T2) union all (T1 join T3)=T1 join (T2 union all T3), where T1, T2 and T3 are three tables. A given query may be rewritten in many alternate ways using join factorization. Evaluating each alternative can be expensive. Therefore, the alternatives are generated and evaluated in a way that minimizes the cost of evaluating the alternatives.
105 Citations
20 Claims
-
1. A computer implemented method, comprising:
-
transforming a base query to generate a transformed query; wherein the base query includes a union between each base branch of a plurality of base branches; wherein each of two or more base branches of said plurality of base branches joins a set of tables; wherein the sets of tables of the two or more base branches of the plurality of base branches include a common table set shared by all the sets of tables, said common table set including a common table; wherein each of the two or more base branches of the plurality of base branches include a respective set of tables that does not include said common table set; wherein the step of transforming the base query includes replacing the plurality of base branches with a first group branch that joins the common table and an inline view, the inline view comprising a union between a plurality of respective branches, wherein the plurality of respective branches includes, for each base branch of said plurality of base branches, a FROM list that; references the respective set of tables, and does not reference the common table; and wherein the method is performed by one or more computing devices. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A computer-readable storage medium storing one or more sequences of instructions which, when executed by one or more processors, cause to perform:
-
transforming a base query to generate a transformed query; wherein the base query includes a union between each base branch of a plurality of base branches; wherein each of two or more base branches of said plurality of base branches joins a set of tables; wherein the sets of tables of the two or more base branches of the plurality of base branches include a common table set shared by all the sets of tables, said common table set including a common table; wherein each of the two or more base branches of the plurality of base branches include a respective set of tables that does not include said common table set; wherein the step of transforming the base query includes replacing the plurality of base branches with a first group branch that joins the common table and an inline view, the inline view comprising a union between a plurality of respective branches, wherein the plurality of respective branches includes, for each base branch of said plurality of base branches, a FROM list that; references the respective set of tables, and does not reference the common table. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
-
Specification