Reordering of complex SQL queries involving GROUPBYs, joins, outer joins and full outer joins
First Claim
1. A method of simplifying an SQL query in a computer having a memory, the SQL query being performed by the computer to retrieve data from a relational database stored in a electronic storage device coupled to the computer, the method comprising the steps of:
- (a) iteratively eliminating, in the memory of the computer, redundant sub-expressions from the SQL query and modifying expensive binary operations in the SQL query to inexpensive binary operations, so that only simple and complex predicates remain in the SQL query; and
(b) iteratively converting, in the memory of the computer, the complex predicates remaining in the SQL query to simple predicates by application of a generalized selection (GS) operator.
1 Assignment
0 Petitions
Accused Products
Abstract
A method, apparatus, and article of manufacture for query simplification by applying generalized inference propagation and generalized transitive closure in SQL queries having selection, projection, join, outer join, and intersection operations. The disclosed transformations and enumeration method unify and solve the problems of 1) unnesting join aggregate queries, and 2) complete enumeration of queries containing outer joins, when the outer join predicate references an aggregated value, or the predicate references more than two base relations in a query subtree. The system first eliminates redundant sub-expressions and modifies expensive binary operations to inexpensive binary operations, then converts complex predicates to simple predicates by application of a generalized selection (GS) operator.
32 Citations
51 Claims
-
1. A method of simplifying an SQL query in a computer having a memory, the SQL query being performed by the computer to retrieve data from a relational database stored in a electronic storage device coupled to the computer, the method comprising the steps of:
-
(a) iteratively eliminating, in the memory of the computer, redundant sub-expressions from the SQL query and modifying expensive binary operations in the SQL query to inexpensive binary operations, so that only simple and complex predicates remain in the SQL query; and (b) iteratively converting, in the memory of the computer, the complex predicates remaining in the SQL query to simple predicates by application of a generalized selection (GS) operator. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
-
-
18. An apparatus for simplifying an SQL query, comprising:
-
(a) a computer having a memory and an electronic storage device coupled thereto, the data storage device storing a relational database; (b) means, performed by the computer, for accepting the SQL query into the memory of the computer, the SQL query being executed by the computer to retrieve data from a relational database stored in the computer; (c) means, performed by the computer, for iteratively eliminating redundant sub-expressions in the SQL query and modifying expensive binary operations in the SQL query to inexpensive binary operations, so that only simple and complex predicates remain in the SQL query; and (d) means, performed by the computer, for iteratively converting the complex predicates in the SQL query to simple predicates by application of a generalized selection (GS) operator. - View Dependent Claims (20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35)
-
-
19. A program storage device readable by a computer, tangibly embodying a program of instructions executable by the computer to perform method steps for simplifying an SQL query in a computer having a memory, the SQL query being performed by the computer to retrieve data from a relational database stored in an electronic storage device coupled to the computer, the method comprising the steps of:
-
(a) iteratively eliminating, in the memory of the computer, redundant sub-expressions in the SQL query and modifying expensive binary operations in the SQL query to inexpensive binary operations, so that only simple and complex predicates remain in the SQL query; and (b) iteratively converting, in the memory of the computer, the complex predicates in the SQL query to simple predicates by application of a generalized selection operator. - View Dependent Claims (36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51)
-
Specification