System and method for optimizing queries
First Claim
1. A computer-implemented method of optimizing a query, comprising:
- receiving a first query configured to generate a result set, wherein the first query comprises an operation for an outer table, a first predicate, and a second predicate comprising a subquery correlating an inner table to the outer table, wherein the first predicate and the second predicate are disjunctive, wherein the subquery comprises an operation for the inner table and a correlation predicate correlating the inner table and the outer table, and wherein the second query comprises a left outer join operation between the inner table and the outer table using the correlation predicate;
generating a first query tree representing the first query;
generating a second query tree representing a second query configured to generate the result set, wherein the second query does not comprise the subquery, and wherein the second query comprises a group by operation configured to generate one row for each row in the outer table, and wherein the group by operation comprises a having clause comprising the first predicate and the second predicate; and
generating a query plan based on the second query tree.
2 Assignments
0 Petitions
Accused Products
Abstract
There is provided a computer-implemented method of optimizing a query. An exemplary method comprises receiving a first query configured to generate a result set. The query may comprise an operation for an outer table, a first predicate, and a second predicate. The second predicate may comprise a subquery correlated to the operation. Additionally, the first predicate and the second predicate may be disjunctive. The exemplary method also comprises generating a first query tree representing the first query, and generating a second query tree representing a second query. The second query may be configured to generate the result set, and may not comprise the subquery. The exemplary method additionally comprises generating a query plan based on the second query tree.
-
Citations
18 Claims
-
1. A computer-implemented method of optimizing a query, comprising:
-
receiving a first query configured to generate a result set, wherein the first query comprises an operation for an outer table, a first predicate, and a second predicate comprising a subquery correlating an inner table to the outer table, wherein the first predicate and the second predicate are disjunctive, wherein the subquery comprises an operation for the inner table and a correlation predicate correlating the inner table and the outer table, and wherein the second query comprises a left outer join operation between the inner table and the outer table using the correlation predicate; generating a first query tree representing the first query; generating a second query tree representing a second query configured to generate the result set, wherein the second query does not comprise the subquery, and wherein the second query comprises a group by operation configured to generate one row for each row in the outer table, and wherein the group by operation comprises a having clause comprising the first predicate and the second predicate; and generating a query plan based on the second query tree. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A computer system for optimizing a query in a database management system (DBMS), the computer system comprising:
-
a processor that is adapted to execute stored instructions; and a memory device that stores instructions, the memory device comprising; computer-implemented code adapted to receive a first query configured to generate a result set, wherein the query comprises an operation for an outer table, a first predicate, and a second predicate, wherein the first predicate comprises a first subquery correlating an inner table to the outer table, wherein the first predicate and the second predicate are disjunctive, wherein the first subquery comprises an operation for the inner table and a correlation predicate correlating the inner table and the outer table, and wherein the second query comprises a left outer join operation between the inner table and the outer table using the correlation predicate; computer-implemented code adapted to generate a first query tree representing the first query; computer-implemented code adapted to generate a second query tree representing a second query configured to generate the result set, wherein the second query does not comprise the first subquery, and wherein the second query comprises a group by operation configured to generate one row for each row in the outer table, and wherein the group by operation comprises a having clause comprising the first predicate and the second predicate; and computer-implemented code adapted to generate a query plan based on the second query tree. - View Dependent Claims (10, 11, 12, 13)
-
-
14. A non-transitory machine-readable medium that stores machine-readable instructions executable by a processor to optimize a query in a database management system (DBMS), the tangible, machine-readable medium comprising:
-
machine-readable instructions that, when executed by the processor, receive a first query configured to generate a result set, wherein the first query comprises an operation for an outer table, a first predicate, and a second predicate comprising a subquery correlated to the operation, wherein the first predicate and the second predicate are disjunctive, wherein the subquery comprises an operation for the inner table and a correlation predicate correlating the inner table and the outer table, and wherein the second query comprises a left outer join operation between the inner table and the outer table using the correlation predicate; machine-readable instructions that, when executed by the processor, generate a first query tree representing the first query; machine-readable instructions that, when executed by the processor, generate a second query tree representing a second query configured to generate the result set, wherein the second query does not comprise the subquery, and wherein the second query comprises a group by operation configured to generate one row for each row in the outer table, and wherein the group by operation comprises a having clause comprising the first predicate and the second predicate; and machine-readable instructions that, when executed by the processor, generate a query plan based on the second query tree. - View Dependent Claims (15, 16, 17, 18)
-
Specification