# US 2021/0334272 A1 · Tolerance level-based tuning of query processing

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0334272 A1
- Document ID: US20210334272A1
- Status: Published application
- Kind: A1
- Application number: 16/859,455
- Filed: 2020-04-27
- Published: 2021-10-28
- Earliest claimed: 2020-04-27
- Assignees: Hewlett Packard Enterprise Development LP
- Applicants: Hewlett Packard Enterprise Development LP
- Inventors: Shine Mathew
- Web page: https://patentgrep.com/patent/US20210334272A1

## CPC

- G06F 16/2453: Query optimisation
- G06F 16/2454: {Optimisation of common expressions}
- G06F 16/217: {Database tuning (G06F16/2282 takes precedence; database performance monitoring G06F11/3409)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An input is accessed representing a tuning parameter for a first query statement and a tolerance level. The tolerance level represents a degree of acceptable discrepancy between the first query statement and another query statement. A first fingerprint is generated for the first query statement based on a content of the first query statement and the tolerance level; and the first fingerprint and the tuning parameter are stored. The first fingerprint is used as an index for an optimizer to associate the tuning parameter with a second query statement that corresponds to the first fingerprint.

## Claims

### Claim 1

A method comprising:
accessing input representing a tuning parameter for a first query statement and a tolerance level, wherein the tolerance level represents a degree of acceptable discrepancy between the first query statement and another query statement;
generating a first fingerprint for the first query statement based on a content of the first query statement and the tolerance level; and
storing the first fingerprint and the tuning parameter, wherein the first fingerprint is used by an optimizer as an index to associate the tuning parameter with a second query statement that corresponds to the first fingerprint.

### Claim 2 (depends on 1)

The method of claim 1, wherein generating the first fingerprint comprises normalizing the first query statement to provide a normalized query statement; and
determining the first fingerprint based on the normalized query statement and the tolerance level.

### Claim 3 (depends on 2)

The method of claim 2, wherein normalizing the first query statement comprises removing at least one of a space, a tab, a line break or a comment of the first query statement.

### Claim 4 (depends on 2)

The method of claim 2, wherein normalizing the first query statement comprises converting a case of the first query statement.

### Claim 5 (depends on 1)

The method of claim 1, wherein generating the first fingerprint comprises:
removing a constant or a parameter from the first query statement to provide a second query statement; and
generating the first fingerprint based on the second query statement.

### Claim 6 (depends on 1)

The method of claim 1, wherein generating the first fingerprint comprises
determining a relational expression tree for the first query statement; and
determining the first fingerprint based on the relational expression tree.

### Claim 7 (depends on 6)

The method of claim 6, wherein determining the first fingerprint based on the relational expression tree comprises determining the first fingerprint based on a shape of the relational expression tree.

### Claim 8 (depends on 6)

The method of claim 6, wherein:
determining the relational expression tree comprises processing the first query statement to remove a column or a predicate to provide a second query statement and determining the relational expression tree based on the second query statement.

### Claim 9

A system comprising:
a processor; and
a memory to store instructions that, when executed by the processor, cause the processor to:
access a first query statement;
determine a first plurality of fingerprints representing the first query statement, wherein the first plurality of fingerprints correspond to different tolerance levels;
compare the first plurality of fingerprints to a second plurality of fingerprints, wherein each fingerprint of the second plurality of fingerprints is associated with a tuning parameter of a plurality of tuning parameters;
based on the comparison, select a tuning parameter of the plurality of tuning parameters; and
process the first query statement based on the selected tuning parameter.

### Claim 10 (depends on 9)

The system of claim 9, wherein:
a given fingerprint of the first plurality of fingerprints corresponds to given tolerance level of the tolerance levels; and
the given tolerance level represents an acceptable degree of discrepancy between the given fingerprint and another fingerprint.

### Claim 11 (depends on 9)

The system of claim 9, wherein the instructions, when executed by the processor, further cause the processor to:
compare a first fingerprint of the first plurality of fingerprints with the second plurality of fingerprints;
select a given tuning parameter of the plurality of tuning parameters associated with a second fingerprint of the second plurality of fingerprints that matches the first fingerprint; and
process the second query statement based on the given tuning parameter.

### Claim 12 (depends on 9)

The system of claim 9, wherein the instructions, when executed by the processor, further cause the processor to:
normalize the first query statement to provide a normalized query statement; and
determine the first plurality of fingerprints based on the normalized query statement.

### Claim 13 (depends on 9)

The system of claim 9, wherein the instructions, when executed by the processor, further cause the processor to:
determine a tree corresponding to the first query statement, wherein the tree comprises nodes corresponding to relational algebra operators; and
determine a given fingerprint of the first plurality of fingerprints based on the tree.

### Claim 14 (depends on 9)

The system of claim 9, wherein the instructions, when executed by the processor, further cause the processor to determine the given fingerprint based on a shape of the tree.

### Claim 15

A non-transitory machine readable storage medium storing instructions that, when executed by a machine, cause the machine to:
access a first query statement, a tuning parameter for the first query statement and a tolerance level defining a degree of association between the first query statement and the tuning parameter;
based on the tolerance level and a content of the first query statement, process the first query statement to generate a first hash value; and
associate the first hash value with the tuning parameter.

### Claim 16 (depends on 15)

The storage medium of claim 15, wherein the instructions, when executed by the machine, further cause the machine to:
process the second query statement to generate a second identifier;
determine a second hash value for the second identifier;
compare the second hash value to the first hash value; and
processing the second query statement based on a result of the comparison.

### Claim 17 (depends on 16)

The storage medium of claim 16, wherein the instructions, when executed by the machine, further cause the machine to:
determine a plurality of hash values for different identifiers for the second query statement; and
process the second query statement in response to comparing the plurality of hash values to a plurality of hash values associated with other tuning parameters.

### Claim 18 (depends on 15)

The storage medium of claim 15, wherein the tuning parameter comprises a directive to be used by a query optimizer in processing query statements having corresponding hash values that correspond to the first hash value.

### Claim 19 (depends on 15)

The storage medium of claim 15, wherein the tuning parameter comprises a query optimizer directive to turn on hash joins for query statements having corresponding hash values that correspond to the first hash value.

### Claim 20 (depends on 15)

The storage medium of claim 15, wherein the instructions, when executed by the machine, further cause the machine to:
normalize the first query statement to provide a first normalized query statement;
in response to the tolerance level representing a first value, generate the hash value based on the first normalized query statement;
in response to the tolerance level representing a second value less restrictive than the first value, process the first normalized query statement to remove at least one of a constant or a predicate from the first normalized query statement to generate a second normalized query statement, and generate the hash value based on the second normalized query statement; and
in response to the tolerance level representing a third value less restrictive than the second value, generate a relational expression tree corresponding to the first normalized query statement, and generate the hash value based on the relational expression tree.
