IP Library Granted Patent US 9,189,520
Granted Patent B2
US 9,189,520 · App. 13/925,610 · Granted Nov 17, 2015

Methods and systems for one dimensional heterogeneous histograms

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,189,520
App. No.
13/925,610
Granted
Nov 17, 2015
Kind
B2
Abstract

A method and system to generate cardinality estimates for at least one query execution plan for a query using a histogram, the cardinality estimation being constrained by a q-error that is a factor by which the estimate deviates, at most, from a true value of the cardinality and a threshold value which the cardinality does not exceed; use the cardinality estimation to determine an optimal query plan for executing the query; and produce an output of the optimal query plan.

Claims (36)

1. A computer-implemented method of optimizing execution of a query that accesses data by a computer, the method comprising:

generating, by a query server having a processor, cardinality estimates for at least one query execution plan to execute a query using a histogram, the cardinality estimation being constrained by a q-error that is a factor by which the estimate deviates, at most, from a true value of the cardinality and a threshold value which the cardinality does not exceed;

using the generated cardinality estimation that adheres to the q-error and threshold value constraints to determine, by the processor of the query server, an optimal query plan for executing the query; and

producing an output of the optimal query plan.

2. The method of claim 1 , wherein the histogram comprises a plurality of buckets, each bucket storing (1) number of distinct values contained in the bucket, and (2) cumulated frequency of the number of distinct values stored.

3. The method of claim 1 , wherein the histogram is a heterogeneous histogram.

4. The method of claim 2 , wherein each of the plurality of buckets is evaluated to determine whether each bucket adheres to the q-error and threshold value constraints.

5. The method of claim 4 , wherein the evaluation is made by using at least one of:

a pre-test of dense buckets, where a dense bucket has the characteristics of the domain of an attribute represented by the histogram is discrete and every domain value within the bucket has a frequency larger than zero; and

in an instance the bucket being evaluated is not a dense bucket, at least one of a binary subtest and a test quadratic for the number of distinct values in the bucket being evaluated.

6. The method of claim 4 , wherein it is determined that each of the plurality of buckets of the histogram adheres to the q-error and threshold value constraints, then the histogram also adheres to the q-error and a factor of the threshold value constraints.

7. A non-transitory medium having program instructions embodied thereon, the medium comprising:

instructions to generate cardinality estimates for at least one query execution plan to execute a query using a histogram, the cardinality estimation being constrained by a q-error that is a factor by which the estimate deviates, at most, from a true value of the cardinality and a threshold value which the cardinality does not exceed;

instructions to use the generated cardinality estimation that adheres to the q-error and threshold value constraints to determine an optimal query plan for executing the query; and

instructions to produce an output of the optimal query plan.

8. The medium of claim 7 , wherein the histogram comprises a plurality of buckets, each bucket storing (1) number of distinct values contained in the bucket, and (2) cumulated frequency of the number of distinct values stored.

9. The medium of claim 7 , wherein the histogram is heterogeneous.

10. The medium of claim 8 , wherein the medium further comprises instructions to evaluate each of the plurality of buckets to determine whether each bucket adheres to the q-error and threshold value constraints.

11. The medium of claim 10 , wherein the medium further comprises, for the evaluation, at least one of:

instructions to perform a pre-test of dense buckets, where a dense bucket has the characteristics of the domain of an attribute represented by the histogram is discrete and every domain value within the bucket has a frequency larger than zero; and

instructions to perform, in an instance the bucket being evaluated is not a dense bucket, at least one of a binary sub-test and a test quadratic for a number of distinct values in the bucket being evaluated.

12. The medium of claim 10 , wherein it is determined that each of the plurality of buckets of the histogram adheres to the q-error and threshold value constraints then the histogram also adheres to the q-error and a factor of threshold value constraints.

13. A system comprises:

a computing device comprising:

a memory storing processor-executable program code; and

a processor to execute the processor-executable program code in order to cause the computing device to:

generate cardinality estimates for at least one query execution plan to execute a query using a histogram, the cardinality estimation being constrained by a q-error that is a factor by which the estimate deviates, at most, from a true value of the cardinality and a threshold value which the cardinality does not exceed;

use the generated cardinality estimation that adheres to the q-error and threshold value constraints to determine an optimal query plan for executing the query; and

produce an output of the optimal query plan.

14. The system of claim 13 , wherein the histogram comprises a plurality of buckets, each bucket storing (1) number of distinct values contained in the bucket, and (2) cumulated frequency of the number of distinct values stored.

15. The system of claim 13 , wherein the histogram is a heterogeneous histogram.

16. The system of claim 14 , wherein each of the plurality of buckets is evaluated to determine whether each bucket adheres to the q-error and threshold value constraints.

17. The system of claim 16 , wherein the evaluation is made by using at least one of:

a pre-test of dense buckets, where a dense bucket has the characteristics of the domain of an attribute represented by the histogram is discrete and every domain value within the bucket has a frequency larger than zero; and

in an instance the bucket being evaluated is not a dense bucket, at least one of a binary sub-test and a test quadratic for the number of distinct values in the bucket being evaluated.

18. The system of claim 16 , wherein it is determined that each of the plurality of buckets of the histogram adheres to the q-error and threshold value constraints then the histogram also adheres to the q-error and a factor of threshold value constraints.

Assignments (2)
CHANGE OF NAME Recorded Aug 26, 2014
From: SAP AG
To: SAP SE
Reel/Frame 033625/0223 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 24, 2013
From: MAY, NORMAN; MOERKOTTE, GUIDO; BOEHM, ALEXANDER
To: SAP AG
Reel/Frame 030676/0123 →