摘要:
An apparatus, program product and method utilize a query optimizer that identifies Join types in a query plan that can be replaced to facilitate optimization of the plan. If the query plan is considered to have a tree-graph representation, then the optimizer locates Join nodes to be replaced and substitutes an Inner Join node and additional nodes that do not inhibit optimization strategies and algorithms. As a result, all Outer Joins, whether left or right, and all Exception Joins, whether left or right, can be removed from the query plan before performing optimizations such as predicate movement, GROUP BY movement, ORDER BY movement, and Join enumeration.
摘要:
A query facility for database queries saves and re-uses query execution strategies, and automatically determines whether a strategy can be re-used when an imported variable changes. The query facility automatically saves one or more logical conditions associated with the one or more imported variables in the query. When the query is reused, the logical conditions are evaluated using the imported variable values, and the previously saved execution strategy is used only if the condition or conditions are met. Preferably, the logical conditions express a range of imported variable values which are included in a database subset data structure used by the saved query execution strategy, such as a materialized query table or partitioned table. Logical conditions are preferably generated by negating the predicates from a logical expression defining the applicability of the execution strategy, inserting the negated predicates into the query, and performing a transitive closure.
摘要:
A relational database system analyzes each potential join in a query, to determine whether a relation involved in the join is subject to a selection criterion, and evaluate whether that selection criterion or the join per se effects a join reduction. The computational expense of generating a look-ahead predicate comprising the tuples of the second relation matching any applicable selection criterion, is compared to the computational savings that result from the join reduction. The most beneficial look-ahead predicate among all potential joins of relations in the query is identified through iterative analysis of all possible joins. Thereafter, membership in the look-ahead predicate is added as a selection criterion on the first relation, and further iterative analysis is performed of all possible joins of the remaining relations and the look-ahead predicate, to iteratively identify additional joins in the query that benefit from the formation of the look-ahead predicate, and potentially form further look-ahead predicates.
摘要:
Continual generation of index advice that includes generating an index advice for an index of a table in a computer database and recording values of statistical attributes of the index advice accumulated across repeated generations of the index advice. The generating and recording typically are carried out continually without user intervention. Embodiments include recording values of attributes of the index advice that specify an index. Typical embodiments also include, continually and without user intervention, recording values of attributes of the index advice that characterize usefulness of an index and recording values of attributes of the index advice that characterize cost of creating an index.
摘要:
In an embodiment, a query tree is created that represents a query expression, where the query tree includes a union of nodes. Each of the nodes represents a respective partition of a table, and the query expression specifies a key value and the table. A determination is made whether a result set exists that includes the key value, where the result set was previously retrieved from the table. If the determination is true, a decision is made based on the result set whether the key value is stored in the respective partition represented by each of the nodes. The nodes for which the key value is not stored in the respective partition are removed from the query tree to create an optimization tree, and the optimization tree is used to retrieve data from the table. In this way, nodes that are not necessary to be searched may be removed from query trees, in order to increase the performance of the query.
摘要:
A database management system maintains a record of queries which can be executed against the database. For a given auxiliary database structure, an advisory function automatically reviews the query record and identifies those queries which might execute with greater efficiency using the auxiliary database structure, presenting analytical information to the user. Preferably, the auxiliary database structure is an index, and the information is used for determining whether to include the index in the database definition. Preferably, a query optimizer records potentially useful indexes when considering multiple alternative database optimizations, and this information is later retrieved to identify queries which would benefit from an index.