# US 2022/0035812 A1 · Execution of query plans

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

- Number: US 2022/0035812 A1
- Document ID: US20220035812A1
- Status: Published application
- Kind: A1
- Application number: 17/224,832
- Filed: 2021-04-07
- Published: 2022-02-03
- Earliest claimed: 2020-07-31
- Assignees: Hewlett Packard Enterprise Development LP
- Applicants: Hewlett Packard Enterprise Development LP
- Inventors: Krishnamoorthy BALARAMAN; Abhijeet WALIMBE; Suresh SOUNDARARAJAN
- Web page: https://patentgrep.com/patent/US20220035812A1

## CPC

- G06F 16/24542: {Plan optimisation}
- G06F 16/24535: {of sub-queries or views}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Example techniques for execution of query plans are described. In an example, a query plan may include a first sub-plan and a second sub-plan that are to provide the same output. One among the first sub-plan and the second sub-plan may be selected during execution of the query plan based on a runtime performance parameter of a component to be involved in execution of the first sub-plan and a runtime performance parameter of a component to be involved in execution of the second sub-plan.

## Claims

### Claim 1

A system comprising:
a processor; and
a memory comprising instructions executable by the processor to:
select, during execution of a query plan comprising a first sub-plan and a second sub-plan, the first sub-plan for execution, wherein the query plan is executable to provide a result for a database query, wherein the first sub-plan and the second sub-plan are to provide the same output, wherein a first component is to be involved in execution of the first sub-plan and a second component is to be involved in execution of the second sub-plan, wherein the selection is based on a runtime performance parameter of the first component and a runtime performance parameter of the second component; and
cause execution of the first sub-plan.

### Claim 2 (depends on 1)

The system of claim 1, wherein the first component is a first disk storing a first file to be used in execution of the first sub-plan, wherein the second component is a second disk storing a second file to be used in execution of the second sub-plan, wherein the runtime performance parameter of the first component comprises a number of access requests being processed by the first disk per unit time, a queue length of waiting requests pending with the first disk, and a latency of the first disk.

### Claim 3 (depends on 1)

The system of claim 1, wherein the first component is a first file to be accessed for execution of the first sub-plan, wherein the second component is a second file to be accessed for execution of the second sub-plan, wherein the runtime performance parameter of the first component is a number of access requests for the first file per unit time, and wherein the runtime performance parameter of the second component is a number of access requests for the second file per unit time.

### Claim 4 (depends on 1)

The system of claim 1, wherein a first plurality of components is to be involved in execution of the first sub-plan, wherein a second plurality of components is to be involved in execution of the second sub-plan, and wherein the instructions are executable to;
compute a first runtime cost for execution of the first sub-plan based on the runtime performance parameters of the first plurality of components;
compute a second runtime cost for execution of the second sub-plan based on the runtime performance parameters of the second plurality of components; and
select the first sub-plan for execution based on a comparison of the first runtime cost and the second runtime cost.

### Claim 5 (depends on 1)

The system of claim 1, wherein a first file is to be accessed to execute the first sub-plan and a second file is to be accessed to execute the second sub-plan, wherein the instructions are executable to:
determine that the first sub-plan is to be executed based on a latency of a network that is to connect a computing device that manages a disk storing the first file and another computing device to which a record from the first file is to be returned for further processing and based on a latency of a network that is to connect a computing device that manages a disk storing the second file and another computing device to which a record from the second file is to be returned for further processing.

### Claim 6 (depends on 1)

The system of claim 1, wherein the instructions are executable to select the first sub-plan based on a first rental cost of a first processor to be involved in execution of the first sub-plan and a second rental cost of a second processor to be involved in execution of the second sub-plan.

### Claim 7 (depends on 1)

The system of claim 1, wherein the query plan comprises a sub-plan selection operator indicating the first sub-plan, the second sub-plan, the first component, and the second component and comprising the instructions to select the first sub-plan and the instructions to cause execution of the first sub-plan.

### Claim 8 (depends on 7)

The system of claim 7, comprising instructions executable to generate the query plan, wherein the instructions are executable to:
generate a first preliminary query plan executable to provide a result for the database query; the first preliminary query plan comprising the first sub-plan;
generate a second preliminary query plan executable to provide a result for the database query, the second preliminary query plan comprising the second sub-plan;
merge the first preliminary query plan and the second preliminary query plan;
generate the sub-plan selection operator; and
generate the query plan.

### Claim 9 (depends on 1)

The system of claim 1, comprising instructions executable to generate the second sub-plan during execution of the query plan.

### Claim 10

A method comprising:
receiving a query plan for execution of a database query, the query plan comprising:
a first plurality of equivalent sub-plans that are to provide the same first output; and
a first sub-plan selection operator indicating components to be involved in execution of each of the first plurality of equivalent sub-plans;
selecting, in response to executing the first sub-plan selection operator during execution of the query plan; a first sub-plan from amongst the first plurality of equivalent sub-plans based on runtime performance parameters of components to be involved in execution of each of the first plurality of equivalent sub-plans; and
executing the first sub-plan for execution of the query plan.

### Claim 11 (depends on 10)

The method of claim 10, wherein the components to be involved in execution of the first sub-plan comprises a first processor that is to execute at least a part of the first sub-plan, wherein the runtime performance parameters of components comprise a busy time of the first processor, and wherein the method comprises determining the busy time of the first processor prior to selecting the first sub-plan.

### Claim 12 (depends on 10)

The method of claim 10, wherein the first plurality of equivalent sub-plans comprises a second sub-plan, wherein selecting the first sub-plan comprises:
comparing runtime performance parameters of components to be involved in execution of the first sub-plan with reference values of the runtime performance parameters; and
comparing the runtime performance parameters of components to be involved in execution of the second sub-plan with the reference values of so the runtime performance parameters.

### Claim 13 (depends on 12)

The method of claim 12, comprising:
computing a first Euclidean distance between the runtime performance parameters of components to be involved in execution of the first sub-plan with the reference values of the runtime performance parameters;
computing a second Euclidean distance between runtime performance parameters of components to be involved in execution of the second sub-plan with the reference values of the runtime performance parameters; and
selecting the first sub-plan based on a comparison of the first Euclidean distance and the second Euclidean distance.

### Claim 14 (depends on 10)

The method of claim 10, wherein the query plan further comprises:
a second plurality of equivalent sub-plans that are to provide the same second output; and
a second sub-plan selection operator indicating components to be involved in execution of each of the second plurality of equivalent sub-plans, wherein the method comprises:
selecting, in response to executing the second sub-plan selection operator during execution of the query plan, a sub-plan from amongst the second plurality of equivalent sub-plans based on runtime performance parameters of the components to be involved in execution of the second plurality of equivalent sub-plans.

### Claim 15 (depends on 10)

The method of claim 10, wherein the query plan comprises a second plurality of equivalent sub-plans that are to provide the same second output, wherein, during execution of the query plan, execution of one of the first plurality of equivalent sub-plans is to commence before commencement of execution of one of the second plurality of equivalent sub-plans, wherein the method comprises:
commencing execution of the first sub-plan upon selection of the first sub-plan; and
selecting one of the second plurality of equivalent sub-plans upon so commencing execution of the first sub-plan for execution.

### Claim 16 (depends on 10)

The method of claim 10, comprising:
determining a first number of times of selection of the first sub-plan;
determining a second number of times of selection of the second sub-plan; and
in response to the first number of times being greater than the second number of times by more than a threshold number of times;
providing a notification to reduce workload of the components to be involved in execution of the first sub-plan; or
providing a feedback to indicate the first sub-plan as a default sub-plan.

### Claim 17

A non-transitory computer-readable medium comprising instructions, the instructions being executable by a processing resource to:
receive a database query in response to which a result is to be provided;
generate a first preliminary query plan that is executable to provide the result and a second preliminary query plan that is executable to provide the result, wherein the first preliminary query plan comprises a first sub-plan, wherein the second preliminary query plan comprises a second sub-plan, wherein the first sub-plan and the second sub-plan are to provide the same output, wherein a first plurality of components is to be involved in execution of the first sub-plan, and wherein a second plurality of components is to be involved in execution of the second sub-plan; and
generate, based on the first preliminary query plan and the second preliminary query plan, a query plan to be executed to output the result for the database query, the query plan comprising:
the first sub-plan;
the second sub-plan; and
a sub-plan selection operator indicating the first plurality of components and the second plurality of components, wherein the sub-plan selection operator is executable during execution of the query plan to select one among the first sub-plan and the second sub-plan based on runtime performance parameters of the first plurality of components and runtime performance parameters of the second plurality of components.

### Claim 18 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein, the instructions are executable to generate the query plan as a tree structure having the sub-plan selection operator as a node, and wherein a node of the first sub-plan and a node of the second sub-plan are child nodes of the sub-plan selection operator in the tree structure.

### Claim 19 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein the first plurality of components comprises a first processor that is to execute at least a part of the first sub-plan, a first memory coupled to the first processor, a first file that is to be accessed to execute the first sub-plan, or a first disk storing the first file, and wherein the second plurality of components comprises a second processor that is to execute at least a part of the second sub-plan, a second memory coupled to the second processor, a second file that is to be accessed to execute the second sub-plan, or a second disk storing the second file.

### Claim 20 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein the instructions are executable to:
generate a plurality of preliminary query plans, each executable to provide the result, the plurality of preliminary query plans comprising the first preliminary query plan and the second preliminary query plan; and
select, from amongst the plurality of preliminary query plans, the first preliminary query plan and the second preliminary query plan for generation of the query plan based on statistics of a database table to be accessed to execute the first preliminary query plan and statistics of a database table to be accessed to execute the second preliminary query plan.
