# US 2021/0081409 A1 · Predicting and halting runaway queries

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

- Number: US 2021/0081409 A1
- Document ID: US20210081409A1
- Status: Published application
- Kind: A1
- Application number: 16/903,157
- Filed: 2020-06-16
- Published: 2021-03-18
- Earliest claimed: 2019-09-16
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Pallab Rath; Hozefa Yusuf Palitanawala; Vijay Simha Joshi
- Web page: https://patentgrep.com/patent/US20210081409A1

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 16/2455: Query execution
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 11/3409: {for performance assessment}
- G06F 11/3419: {by assessing time}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/24542: {Plan optimisation}
- G06F 16/24549: {Run-time optimisation}
- G06F 2201/80: Database-specific techniques
- G06F 2201/81: Threshold
- G06F 2209/5022: Workload threshold
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Operations include halting a runaway query in response to determining that a performance metric of the query exceeds a performance threshold. The runaway query halting system receives a query execution plan associated with a query and divides the received execution plan into one or more components. For each component, the system determines a predicted resource usage associated with executing the component. The system further determines a predicted resource usage associated with the query execution plan based on the predicted resource usage associated with each component. The system executes the query associated with the received query execution plan and compares the predicted resource usage associated with the query to a resource usage threshold. In response to determining that the predicted resource usage of the query execution plan exceeds the resource usage threshold, the system halts execution of the query associated with the query execution plan.

## Claims

### Claim 1

One or more non-transitory computer readable media comprising instructions which, when executed, by one or more hardware processors, cause performance of operations comprising:
receiving a query execution plan associated with a query;
dividing the received execution plan into one or more components;
determining, for each component, a predicted resource usage associated with executing the component;
determining, based on the predicted resource usage associated with each component, a predicted resource usage associated with the query execution plan;
executing the query associated with the received query execution plan;
comparing the predicted resource usage associated with the query to a resource usage threshold; and
halting execution of the query associated with the query execution plan in response to a determination that the predicted resource usage of the query execution plan exceeds the resource usage threshold.

### Claim 2 (depends on 1)

The one or more media of claim 1, wherein halting execution of the query associated with the query execution plan comprises:
executing one or more undo commands to rollback a state of one or more tables on which the query has performed operations.

### Claim 3 (depends on 2)

The one or more media of claim 2, wherein halting execution of the query associated with the query execution plan comprises:
determining a predicted resource usage associated with completing execution of the query execution plan;
determining a resource usage associated with executing the one or more undo commands;
halting execution of the query associated with the query execution plan in response to determining that the predicted resource usage associated with completing execution of the query execution plan exceeds the resource usage associated with executing the one or more undo commands.

### Claim 4 (depends on 1)

The one or more media of claim 1, wherein a predicted resource usage associated with executing a particular component, of the one or more components, is determined based on one or more attributes of the particular component.

### Claim 5 (depends on 4)

The one or more media of claim 4, wherein the predicted resource usage associated with executing a particular component, of the one or more components, is determined based on resource usage of prior executions of query components having similar attributes.

### Claim 6 (depends on 1)

The one or more media of claim 1, wherein the resource usage threshold is determined based on capacity of a system executing the received query execution plan.

### Claim 7 (depends on 1)

The one or more media of claim 1, wherein the predicted resource usage comprises a predicted processing unit utilization.

### Claim 8 (depends on 1)

The one or more media of claim 1, wherein the resource usage threshold is determined based on a disk input/output capacity of a system executing the received query execution plan.

### Claim 9

One or more non-transitory computer readable media comprising instructions which, when executed, by one or more hardware processors, cause performance of operations comprising:
receiving a query execution plan associated with a query;
dividing the received execution plan into one or more components;
determining, for each component, an expected time duration associated with executing the component;
executing the query associated with the received query execution plan;
comparing a current running time of the query execution plan to a threshold time duration; and
halting execution of the query associated with the query in response to a determination that the current running time of the query execution plan exceeds the threshold time duration.

### Claim 10 (depends on 9)

The one or more media of claim 9, wherein halting execution of the query associated with the query execution plan comprises:
executing one or more undo commands to rollback a state of one or more tables on which the query has performed operations.

### Claim 11 (depends on 10)

The one or more media of claim 10, wherein halting execution of the query associated with the query execution plan comprises:
determining a predicted resource usage associated with completing execution of the query execution plan;
determining a resource usage associated with executing the one or more undo commands;
halting execution of the query associated with the query execution plan in response to determining that the predicted resource usage associated with completing execution of the query execution plan exceeds the resource usage associated with executing the one or more undo commands.

### Claim 12 (depends on 9)

The one or more media of claim 9, wherein an expected time duration associated with executing a particular component, of the one or more components, is determined based on one or more attributes of the particular component.

### Claim 13 (depends on 12)

The one or more media of claim 12, wherein the expected time duration associated with executing a particular component, of the one or more components, is determined based on resource usage of prior executions of query components having similar attributes.

### Claim 14 (depends on 9)

The one or more media of claim 9, wherein the time duration threshold is determined based on the expected time durations associated with executing each of the one or more components.

### Claim 15

One or more non-transitory computer readable media comprising instructions which, when executed, by one or more hardware processors, cause performance of operations comprising:
receiving a query execution plan associated with a query;
identifying statistics associated with prior executions of the query execution plan;
determining, based on the statistics associated with the prior executions of the query execution plan, a threshold time duration associated with the query execution plan;
executing the query associated with the received query execution plan;
comparing a current running time of the query execution plan to the threshold time duration; and
halting execution of the query associated with the query execution plan in response to a determination that the current running time of the query execution plan exceeds the threshold time duration.

### Claim 16 (depends on 15)

The one or more media of claim 15, wherein halting execution of the query associated with the query execution plan comprises:
executing one or more undo commands to rollback a state of one or more tables on which the query has performed operations.

### Claim 17 (depends on 16)

The one or more media of claim 16, wherein halting execution of the query associated with the query execution plan comprises:
determining a predicted resource usage associated with completing execution of the query execution plan;
determining a resource usage associated with executing the one or more undo commands;
halting execution of the query associated with the query execution plan in response to determining that the predicted resource usage associated with completing execution of the query execution plan exceeds the resource usage associated with executing the one or more undo commands.

### Claim 18 (depends on 15)

The one or more media of claim 15, further comprising:
determining one or more attributes of the received query execution plan,
wherein the threshold time duration is determined based on statistics associated with prior executions of queries having similar attributes to the one or more attributes of the query execution plan.

### Claim 19 (depends on 15)

The one or more media of claim 15, wherein the threshold time duration is determined based on an amount of resources available to a system during execution of the query execution plan.

### Claim 20 (depends on 15)

The one or more media of claim 15, wherein the threshold time duration is determined based on completion times of the prior executions of the query execution plan.
