×

Query selectivity estimation with confidence interval

  • US 7,636,707 B2
  • Filed: 04/06/2004
  • Issued: 12/22/2009
  • Est. Priority Date: 04/06/2004
  • Status: Active Grant
First Claim
Patent Images

1. A method implemented at least in part by a processor executing computer-executable instructions stored in computer-readable storage media for selecting a query plan from at least two query plans, each of the at least two query plans having a query expression on a database, the method comprising:

  • computing a uniform random sample of database tuples by randomly sampling tuples from the database;

    for each of the at least two query plans, deriving, by the processor, a probability distribution for possible selectivity values of the query expression by evaluating each query expression on the sample of database tuples to determine an observed selectivity for the sample of database tuples;

    forming a probability density function based on the observed selectivity using Bayes'"'"'s rule;

    receiving a desired selectivity confidence threshold from a user input, wherein the desired selectivity confidence threshold represents a tradeoff between predictability and performance for query execution time;

    evaluating, by the process, each of the derived probability distributions using the desired selectivity confidence threshold to derive an estimated selectivity for the derived probability distribution, wherein the estimated selectivity is derived by inverting a cumulative distribution function for the probability distribution and applying the inverted cumulative distribution function to the desired selectivity confidence threshold;

    selecting one of the query plans from the at least two query plans based on the estimated selectivities and at least one crossover point, each at least one crossover point defining a selectivity where query execution time of one query plan is estimated to equal query execution time of another query plan of the at least two query plans; and

    executing the selected query plan to retrieve and store records from a database.

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