Query optimizer system and method
First Claim
1. A method for constructing an optimal representation for an input query, the method comprising:
- receiving the input query, wherein the input query is an intermediate language representation comprising nodes, each node having a respective node type;
examining the nodes in a left-depth first manner to identify node types for optimization;
tagging nodes corresponding to the identified node types;
moving upward to the next node until the intermediate language representation of the input query has been examined in its entirety;
searching from the top of the intermediate language representation for tagged nodes and identifying code patterns to be optimized; and
adjusting the identified code patterns with improved code patterns to form an optimal representation for the input query,wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code rewrites, tuple rewrites, position rewrites, commutations. inlining and sort elimination.
2 Assignments
0 Petitions
Accused Products
Abstract
An optimizer/normalizer is used to generate optimized intermediate language representation of an input query, such as an XML input query. A method of optimization of an input query in intermediate language form includes receiving the input query, examining the nodes in a left-depth first manner to identify code patterns and node types which are subjects for optimization, tagging the identified code patterns until the intermediate language representation of the input query has been examined in its entirety, searching from the top of the intermediate language representation for tagged code patterns, and adjusting the tagged code patterns with improved code patterns to form an optimal representation for an input query. The input to the optimizer/normalizer is assumed to be an input query transformed into an intermediate language representation containing code patterns and nodes, each node having a respective node type.
-
Citations
12 Claims
-
1. A method for constructing an optimal representation for an input query, the method comprising:
-
receiving the input query, wherein the input query is an intermediate language representation comprising nodes, each node having a respective node type; examining the nodes in a left-depth first manner to identify node types for optimization;
tagging nodes corresponding to the identified node types;moving upward to the next node until the intermediate language representation of the input query has been examined in its entirety; searching from the top of the intermediate language representation for tagged nodes and identifying code patterns to be optimized; and adjusting the identified code patterns with improved code patterns to form an optimal representation for the input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code rewrites, tuple rewrites, position rewrites, commutations. inlining and sort elimination. - View Dependent Claims (2, 3)
-
-
4. A computer-readable medium having computer-executable instructions executed by a processor for performing a method for constructing an optimal representation for an input query, the method comprising:
-
receiving the input query, wherein the input query is an intermediate language representation containing code patterns and nodes, each node having a respective node type; examining the nodes in a left-depth first manner to identify code patterns and node types which are subjects for optimization; tagging the identified code patterns until the intermediate language representation of the input query has been examined in its entirety; searching from the top of the intermediate language representation for tagged code patterns; and adjusting the tagged code patterns with improved code patterns to form an optimal representation for an input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code rewrites, tuple rewrites, position rewrites, commutations, inlining and sort elimination.
-
-
5. A computer system for generating an optimized representation of an XML intermediate language representation of one or more of input queries comprising:
-
one or more of input devices for receiving the one or more input queries; one or more intermediate language compilers wherein each compiler generates an intermediate language representation of an input query; an expression accumulator which combines each intermediate language representation into a single XML intermediate language representation; and an optimizer performing the acts of; receiving the input query, wherein the input query is an intermediate language representation containing code patterns and nodes, each node having a respective node type; examining the nodes in a left-depth first manner to identify code patterns and node types which are subjects for optimization; tagging the identified code patterns until the intermediate language representation of the input query has been examined in its entirety; searching from the top of the intermediate language representation for tagged code patterns; and adjusting the tagged code patterns with improved code patterns to form an optimal representation for an input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code rewrites. tuple rewrites, position rewrites, commutations, inlining and sort elimination. - View Dependent Claims (6, 7)
-
-
8. A method for constructing an optimal representation for an input query, the method comprising:
-
receiving the input query, wherein the input query is an intermediate language representation containing nodes, each node having a respective node type; examining the nodes to inspect code patterns associated with respective node types; comparing the inspected code patterns using a pattern match algorithm to detect non-optimized code patterns; and adjusting one or more of the non-optimized code patterns and the inspected code patterns with improved code patterns to form an optimal representation for an input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code rewrites, tuple rewrites, position rewrites, commutations, inlining and sort elimination. - View Dependent Claims (9, 10)
-
-
11. A computer-readable medium having computer-executable instructions executed by a processor for performing a method for constructing an optimal representation for an input query, the method comprising:
-
receiving the input query, wherein the input query is an intermediate language representation containing nodes, each node having a respective node type; examining the nodes to inspect code patterns associated with respective node types;
comparing the inspected code patterns using a pattern match algorithm to detect non-optimized code patterns; andadjusting one or more of the non-optimized code patterns and the inspected code patterns with improved code patterns to form an optimal representation for an input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code, tuple rewrites, position rewrites, commutations, inlining and sort elimination.
-
-
12. A computer system for generating an optimized representation of an XML intermediate language representation of one or more of input queries comprising:
-
one or more of input devices for receiving the one or more input queries; one or more intermediate language compilers wherein each compiler generates an intermediate language representation of an input query; an expression accumulator which combines each intermediate language representation into a single XML intermediate language representation; and an optimizer performing the acts of; receiving the input query, wherein the input query is an intermediate language representation containing nodes, each node having a respective node type; examining the nodes to inspect code patterns associated with respective node types; comparing the inspected code patterns using a pattern match algorithm to detect non-optimized code patterns; and adjusting one or more of the non-optimized code patterns and the inspected code patterns with improved code patterns to form an optimal representation for an input query, wherein the improved code patterns are generated using one or more translations comprising at least one of constant folding, logical rewrites, path rewrites, loop-invariant code, tuple rewrites, position rewrites, commutations, inlining and sort elimination.
-
Specification