IP Library Granted Patent US 9,922,080
Granted Patent B2
US 9,922,080 · App. 14/736,504 · Granted Mar 20, 2018

Query plan determination

Inventors: Qifan Chen (Austin, TX); Hao Qin (Shanghai, CN); Taoufik Ben Abdellatif (Austin, TX)
Assignee: Hewlett Packard Enterprise Development LP
G06F17/30442
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,922,080
App. No.
14/736,504
Filed
Jun 11, 2015
Granted
Mar 20, 2018
Kind
B2
Art Unit
2169
USPC
707/718
Abstract

In one example in accordance with the present disclosure, a method for determining query plans includes obtaining a current query and generating a first literal and a first signature key from the current query. The method includes determining that the first signature key matches a second signature key stored in a parser cache and obtaining a literals data structure corresponding to the second signature key. The literals data structure comprises a group of literals, a list of high and low boundary intervals and a parameterization indicator. The method includes identifying, using the parameterization indicator, a parameterized literal in the group of literals. The method includes determining that a high and low boundary interval for the second parameterized literal contains the first literal and executing a stored query plan on the current query.

Claims (51)

1. A method for determining query plans using at least one processor, the method comprising:

obtaining a current query;

generating a first parameterized literal and a first signature key from the current query;

determining that the first signature key matches a second signature key stored in a cache;

obtaining a literals data structure corresponding to the second signature key, the literals data structure comprising a group of literals, a list of high and low boundary intervals, a parameterization indicator, and a query plan key;

identifying, using the parameterization indicator, a second parameterized literal in the group of literals;

determining that a high and low boundary interval for the second parameterized literal contains the first parameterized literal;

obtaining a stored query plan for the second signature key using the query plan key; and

executing, by the at least one processor, the stored query plan on the current query.

2. The method of claim 1 , wherein generating the first parameterized literal and the first signature key from the current query occurs during a parsing stage of a query compilation.

3. The method of claim 1 , wherein the first signature key comprises a first sequence of tokens corresponding to the structure of the current query and the second signature key comprises a second sequence of tokens corresponding to the structure of a previous query.

4. The method of claim 1 further comprising:

parsing the current query into a first non-parameterized literal;

identifying, using the parameterization indicator, a second non-parameterized literal in the group of literals; and

determining that the first non-parameterized literal matches the second non-parameterized literal.

5. The method of claim 1 , wherein the cache comprises a hash table including a group of signature keys and each signature key is associated with a corresponding literals data structure.

6. A system for determining query plans comprising:

a processor that:

obtains a current query;

parses the current query into a first parameterized literal and a first signature key;

determines that the first signature key matches a second signature key stored in a hash table;

obtains a literals data structure from the hash table corresponding to the second signature key, the literals data structure comprising a group of literals, a parameterization indicator, and a statistical histogram for each parameterized literal in the group of literals, each statistical histogram comprising a list of intervals defined by a low bound and a high bound;

identifies, using the parameterization indicator, a second parameterized literal in the group of literals;

determines that the first parameterized literal is contained in a range defined by the low bound and the high bound of the statistical histogram for the second parameterized literal;

obtains a stored query plan for the second signature key; and

executes the query plan on the current query.

7. The system of claim 6 , wherein the list of intervals for each statistical histogram is further defined by a row count and a unique entry count, and the processor:

determines a first density of a first interval in the list of intervals and a second density of a second interval in the list of intervals, wherein the density is based on the row count and the unique entry count;

determines that the first density is the same as the second density; and

combines the first interval and the second interval.

8. The system of claim 6 , wherein the processor:

parses the current query into a first non-parameterized literal;

identifies, using the parameterization indicator, a second non-parameterized literal in the group of literals; and

determines that the first non-parameterized literal matches the second non-parameterized literal.

9. The system of claim 6 wherein the literals data structure further comprises a query plan key and the processor obtains the stored query plan for the second signature key using the query plan key.

10. The system of claim 6 , wherein the processor parses the current query into a first parameterized literal and a first signature key during a parsing stage of a query compilation.

11. The system of claim 6 , wherein the processor generates an equivalent class of queries, wherein each query in the equivalent class of queries contains an identical histogram interval for each parameterized literal parsed from the current query and each query in the equivalent class of queries uses the stored query plan.

12. A non-transitory machine-readable storage medium comprising instructions executable by a processor of a computing device for determining query plans, the machine-readable storage medium comprising:

instructions to obtain a current query containing a first equality function;

instructions to parse the current query into a first parameterized literal and a first signature key, wherein the first parameterized literal is used in the first equality function;

instructions to determine that the first signature key matches a second signature key;

instructions to obtain a literals data structure corresponding to the second signature key, the literals data structure comprising a group of literals, a list of high and low boundary intervals, a parameterization indicator and a query plan key;

instructions to identify, using the parameterization indicator, that a second parameterized literal in the group of literals is used in a second equality function corresponding to the second signature key;

instructions to determine that a high and low boundary interval for the second parameterized literal contains the first parameterized literal;

instructions to obtain a query plan for the second signature key using the query plan key; and

instructions to execute the query plan on the current query.

13. The non-transitory machine-readable storage medium of claim 12 , further comprising:

instructions to parse the current query into a first non-parameterized literal, wherein the first non-parameterized literal is not used in the equality function in the current query;

identifying, using the parameterization indicator, a second non-parameterized literal in the group of literals, wherein the second non-parameterized literal is not used in the second equality function corresponding to the second signature key; and

determining that the first non-parameterized literal matches the second non-parameterized literal.

14. The non-transitory machine-readable storage medium of claim 12 , wherein the first signature key comprises a first sequence of tokens corresponding to the structure of the current query and the second signature key comprises a second sequence of tokens corresponding to the structure of a previous query.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 9, 2015
From: HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
To: HEWLETT PACKARD ENTERPRISE DEVELOPMENT LP
Reel/Frame 037079/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 26, 2015
From: CHEN, QIFAN; QIN, HAO; BEN ABDELLATIF, TAOUFIK
To: HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
Reel/Frame 035914/0967 →
Continuity (1)
Related Publication 20160364447A1 · Dec 15, 2016