Flexible query hints in a relational database
First Claim
1. A method implemented on a general-purpose computing device for discovering and expressing query hints in a database management system, comprising:
- using the general-purpose computing device to perform the following;
input a query having an initial query execution plan;
computing a direct acyclic graph for the query;
constraining the query using a power hints query language expression that is appended to the query and contains a predicate;
computing candidate matches for each operator in the initial execution plan;
enumerating possible query execution plans in the directed acyclic graph and filtering out any of the possible query execution plans that do not match the power hints language expression to obtain filtered possible query execution plans;
extracting a revised query execution plan that is a revision of the initial query execution plan, the revised query execution plan being one of the filtered possible query execution plans having a lowest cost as determined by a query optimizer cost model that satisfies constraints of the power hints query language expression;
displaying the revised query execution plan in a graphical manner to a user; and
allowing the user to change the revised query execution plan if the user is not satisfied with the revised query execution plan.
2 Assignments
0 Petitions
Accused Products
Abstract
A flexible query hints system and method for discovering and expressing query hints in a database management system. Embodiments of the flexible query hints system and method include a power hints (Phints) language that enables the specification of constraints to influence a query optimizer. Phints expressions are defined as tree patterns annotated with constraints. Embodiments of the flexible query hints system and method also include techniques to incorporate the power hints language expressions into an extended query optimizer. Theses techniques include computing a directed acyclic graph for Phints expression, deriving candidate matches using the Phints expression and the graph, computing candidate matches, and extracting a revised execution plan having a lowest cost and satisfying constraints of the Phints expression. Embodiments of the flexible query hints system and method include a flexible query hint user interface that allow users to interactively adjust query hints.
-
Citations
20 Claims
-
1. A method implemented on a general-purpose computing device for discovering and expressing query hints in a database management system, comprising:
using the general-purpose computing device to perform the following; input a query having an initial query execution plan; computing a direct acyclic graph for the query; constraining the query using a power hints query language expression that is appended to the query and contains a predicate; computing candidate matches for each operator in the initial execution plan; enumerating possible query execution plans in the directed acyclic graph and filtering out any of the possible query execution plans that do not match the power hints language expression to obtain filtered possible query execution plans; extracting a revised query execution plan that is a revision of the initial query execution plan, the revised query execution plan being one of the filtered possible query execution plans having a lowest cost as determined by a query optimizer cost model that satisfies constraints of the power hints query language expression; displaying the revised query execution plan in a graphical manner to a user; and allowing the user to change the revised query execution plan if the user is not satisfied with the revised query execution plan. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
-
14. A computer-implemented method for revising an initial query execution plan for a query in a database management system on the computer, comprising:
using the computer to perform the following; computing a direct acyclic graph for the query; defining a power hints language where expressions in the power hints language are tree patterns in the acyclic graph annotated with constraints; constraining the query using a power hints language expression that is appended to the query and contains a predicate; enumerating each of the possible query execution plans in the direct acyclic graph; filtering out the possible query execution plans that do not match the power hints language expression; and finding a matching query execution plan have a lowest estimated cost to determine a revised query execution plan, which is a revision of the initial query execution plan for the query. - View Dependent Claims (15, 16, 17, 18)
-
19. A computer-implemented process contained on a computer-readable storage media having stored and encoded thereon computer-executable instructions for execution on a general-purpose computing device for incorporating query hints into a query optimizer of a database management system, comprising:
using the general-purpose computing device to perform the following process actions; inputting a query; computing a directed acyclic graph for the query; creating a power hints language expression using a power hints language; constraining the query using the power hints language expression that is appended to the query and contains a predicate; deriving candidate matches for subplans of an execution plan for the query using the power hints language expression and the directed acyclic graph;
inputting OR nodes from the directed acyclic graph;
implementing a first memoization to guarantee that each OR node is computed once;selecting an OR node to process and a child alternative for the selected OR node; implementing a second memoization to guarantee that each OP node in the child alternative is processed once; selecting an OP node to process;
creating an extended OP node from the selected OP node;setting any children of the extended OP node; determining cost for the extended OP node; computing candidate matches for the extended OP node from the derived candidate matches; and extracting a revised query execution plan having a lowest cost and satisfying constraints given the power hints language expression. - View Dependent Claims (20)
Specification