# US 2016/0253385 A1 · Global query hint specification

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

- Number: US 2016/0253385 A1
- Document ID: US20160253385A1
- Status: Published application
- Kind: A1
- Application number: 15/150,363
- Filed: 2016-05-09
- Published: 2016-09-01
- Earliest claimed: 2013-02-13
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: Neil Thombre; Anurag Windlass Gupta; Stefano Stefani; Aleksandras Surna
- Web page: https://patentgrep.com/patent/US20160253385A1

## CPC

- G06F 16/24549: {Run-time optimisation}
- G06F 16/2453: Query optimisation
- G06F 16/24534: {Query rewriting; Transformation}
- G06F 16/24542: {Plan optimisation}
- G06F 16/282: {Hierarchical databases, e.g. IMS, LDAP data stores or Lotus Notes}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A query optimizer may receive a query (e.g., from a source that generated the query). Input that specifies both a query hint string and a hint may be received to a hint specification interface. The hint may be applied to the query, from outside the query, to optimize a query execution plan. Applying the hint may be based, at least in part, on a query hint string. For example, which query block is associated with the query hint string may be determined. Upon such a determination, the hint may be applied to the determined query block.

## Claims

### Claim at position 1

-20. (canceled)

### Claim 21

A system, comprising:
a memory; and
one or more processors coupled to the memory, wherein the memory comprises program instructions that when executed by the one or more processors causes the one or more processors to:
receive a query directed to a data store;
separate from the query, receive a specification of both a query hint string and a hint;
identify two or more query blocks of the query associated with the query hint string;
optimize a query execution plan for the query, wherein to optimize the query execution plan the program instructions cause the one or more processors to apply the query hint to the two or more query blocks to modify the query from outside the query; and
execute the query execution plan to query the data store.

### Claim 22 (depends on 21)

The system of claim 21, wherein to identify the two or more query blocks of the query that are associated with the query hint string, the program instructions cause the one or more processors to:
determine that the two or more query blocks includes the query hint string; or
determine that a hashed version of the two or more query blocks matches a hash value associated with the query hint string.

### Claim 23 (depends on 21)

The system of claim 21, wherein the query hint is received via a hint specification interface.

### Claim 24 (depends on 21)

The system of claim 21, wherein the query hint is received prior to the query.

### Claim 25 (depends on 21)

The system of claim 21, wherein at least one of the two or more query blocks is one of nested set of query blocks in the query, and wherein the query hint is applied to the nested of query blocks in the query.

### Claim 26 (depends on 21)

The system of claim 21, wherein the program instructions cause the one or more processors to further:
receive another query directed to the data store;
identify one or more other query blocks of the other query associated with the query hint string;
optimize another query execution plan for the other query, wherein to optimize the other query execution plan the program instructions cause the one or more processors to apply the query hint to the one or more other query blocks to modify the other query from outside the other query; and
execute the other query execution plan to query the data store

### Claim 27 (depends on 21)

The system of claim 21, wherein the data store is a distributed data store, wherein the distributed data store comprises a plurality of storage nodes, wherein one of the storage nodes is a leader node, wherein other ones of the storage nodes are compute nodes, wherein the leader node performs the receipt of the query, the receipt of the specification of both the query hint and the query hint string, the identification of the two or more query blocks, and the optimization of the query execution plan, and wherein the compute nodes perform the execution of the query execution plan.

### Claim 28

A method, comprising:
performing, by one or more computing devices:
receiving a query directed to a data store;
separate from the query, receiving a specification of both a query hint string and a hint;
identifying two or more query blocks of the query associated with the query hint string;
optimizing a query execution plan for the query, wherein to optimize the query execution plan the program instructions cause the one or more processors to apply the query hint to the two or more query blocks to modify the query from outside the query; and
executing the query execution plan to query the data store.

### Claim 29 (depends on 28)

The method of claim 28, wherein identifying the two or more query blocks of the query that are associated with the query hint string comprises:
determining that the two or more query blocks includes the query hint string; or
determining that a hashed version of the two or more query blocks matches a hash value associated with the query hint string.

### Claim 30 (depends on 28)

The method of claim 28, wherein the query hint is received via a hint specification interface.

### Claim 31 (depends on 28)

The method of claim 28, wherein the query hint is received prior to the query.

### Claim 32 (depends on 28)

The method of claim 28, wherein at least one of the two or more query blocks is one of nested set of query blocks in the query, and wherein the query hint is applied to the nested of query blocks in the query.

### Claim 33 (depends on 28)

The method of claim 28, further comprising:
receiving another query directed to the data store;
identifying one or more other query blocks of the other query associated with the query hint string;
optimizing another query execution plan for the other query, wherein to optimize the other query execution plan the program instructions cause the one or more processors to apply the query hint to the one or more other query blocks to modify the other query from outside the other query; and
executing the other query execution plan to query the data store

### Claim 34 (depends on 1)

The method of claim 1, wherein the data store is a distributed data store, wherein the distributed data store comprises a plurality of storage nodes, wherein one of the storage nodes is a leader node, wherein other ones of the storage nodes are compute nodes, wherein the leader node performs the receiving of the query, the receiving of the specification of both the query hint and the query hint string, the identifying of the two or more query blocks, and the optimizing of the query execution plan, and wherein the compute nodes perform the executing of the query execution plan.

### Claim 35

A non-transitory, computer-readable storage medium, storing program instructions that when executed by one or more computing devices cause the one or more computing devices to implement:
receiving a query directed to a data store;
separate from the query, receiving a specification of both a query hint string and a hint;
identifying two or more query blocks of the query associated with the query hint string;
optimizing a query execution plan for the query, wherein to optimize the query execution plan the program instructions cause the one or more processors to apply the query hint to the two or more query blocks to modify the query from outside the query; and
executing the query execution plan to query the data store.

### Claim 36 (depends on 35)

The non-transitory, computer-readable storage medium of claim 35, wherein, in identifying the two or more query blocks of the query that are associated with the query hint string, the program instructions cause the one or more computing devices to implement:
determining that the two or more query blocks includes the query hint string; or
determining that a hashed version of the two or more query blocks matches a hash value associated with the query hint string.

### Claim 37 (depends on 35)

The non-transitory, computer-readable storage medium of claim 35, wherein the query hint is received via a hint specification interface.

### Claim 38 (depends on 35)

The non-transitory, computer-readable storage medium of claim 35, wherein the query hint is received prior to the query.

### Claim 39 (depends on 35)

The non-transitory, computer-readable storage medium of claim 35, wherein at least one of the two or more query blocks is one of nested set of query blocks in the query, and wherein the query hint is applied to the nested of query blocks in the query.

### Claim 40 (depends on 35)

The non-transitory, computer-readable storage medium of claim 35, wherein the program instructions cause the one or more computing devices to further implement:
receiving another query directed to the data store;
identifying one or more other query blocks of the other query associated with the query hint string;
optimizing another query execution plan for the other query, wherein to optimize the other query execution plan the program instructions cause the one or more processors to apply the query hint to the one or more other query blocks to modify the other query from outside the other query; and
executing the other query execution plan to query the data store
