×

System and method for optimizing database queries with improved performance enhancements

  • US 6,021,405 A
  • Filed: 12/11/1996
  • Issued: 02/01/2000
  • Est. Priority Date: 08/23/1996
  • Status: Expired due to Term
First Claim
Patent Images

1. A method for generating a plan for executing a database query, comprising:

  • (a) providing said database query with an optimization goal;

    (b) representing said database query as a query tree including one or more levels of logical expressions, each logical expression including zero or more logical expressions as inputs, a subset of said inputs representing one or more subtrees, each subtree having a top logical expression and one or more logical expressions as inputs, each level other than a top level having one or more logical expressions that are input to a higher level logical expression at a preceding level, one of said logical expressions representing a root expression;

    (c) storing in a memory a search data structure for storing a plurality of groups, each group including at least one logical expression from said query tree, zero or more equivalent expressions associated therewith, one or more plans, and one or more contexts, each of said plans implementing at least one expression associated with said group and having an optimization goal, each of said contexts having an associated optimization goal and representing ones of said plans that are compatible with said context'"'"'s associated optimization goal;

    (d) obtaining a plurality of rules for use in generating one or more equivalent expressions or one or more plans, a first subset of said rules including context-free rules for application once to a particular logical expression, a second subset of said rules including context-sensitive rules for application once to a particular logical expression for a particular optimization goal;

    (e) partitioning said query tree into one or more levels of subproblems, each subproblem including one or more of said logical expressions, a first level having one of said subproblems representing said root expression, each subproblem at each subsequent level representing one of said inputs to a corresponding logical expression at a preceding level, each subproblem associated with one of said groups and including a specified optimization goal;

    (f) optimizing each of said subproblems so that at least one plan is obtained for each of said subproblems, said optimizing step further comprising the steps of;

    (1) searching each of said contexts of a specified subproblem'"'"'s group for at least one plan having an optimization goal that is suitable for said specified subproblem'"'"'s optimization goal;

    (2) when no plan is found, determining a set of rules for use in generating zero or more plans that satisfy said specified subproblem'"'"'s optimization goal, said set including zero or more context-free rules and zero or more context-sensitive rules;

    (3) applying each of said context-free rules in the determined set to one or more specified logical expressions in said specified subproblem if not applied previously and applying each of said context-sensitive rules in said determined set to one or more specified logical expressions for a particular optimization goal if not applied previously; and

    (4) storing zero or more equivalent expressions or plans generated from said application in said specified subproblem'"'"'s group in said search data structure; and

    (g) generating a plan for said database query from said plans associated with each of said subproblems.

View all claims
  • 5 Assignments
Timeline View
Assignment View
    ×
    ×