# US 12,222,938 B1 · Systems and methods for query optimization

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

- Number: US 12,222,938 B1
- Document ID: US12222938B1
- Status: Granted
- Kind: B1
- Application number: 18/394,493
- Filed: 2023-12-22
- Granted: 2025-02-11
- Earliest claimed: 2023-12-22
- Assignees: Capital One Services, LLC
- Applicants: Capital One Services, LLC
- Inventors: Mohamed Seck; Pavlo Savchuk; Nikitha Kondapally; Chris Gallucci; Prerna Kandhari; Anand Annamalai
- Web page: https://patentgrep.com/patent/US12222938B1

## CPC

- G06F 16/24534: {Query rewriting; Transformation}
- G06F 11/3409: {for performance assessment}
- G06F 16/243: {Natural language query formulation}
- G06F 16/2453: Query optimisation
- G06F 16/2455: Query execution
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for query optimization may include capturing a proposed database query input into a user interface. The method may further include providing the proposed database query to a machine-learning model. The machine-learning model may have been trained, using one or more gathered and/or simulated sets of query execution overhead data and one or more gathered and/or simulated sets of database queries, to determine a potential execution overhead of a database query and output a query execution score. The method may further include outputting, by the machine-learning model, the query execution score based on the proposed database query. The method may further include determining that the query execution score exceeds a query execution score threshold. The method may further include triggering a corrective action based on the query execution score exceeding the query execution score threshold.

## Claims

### Claim 1

A computer-implemented method comprising:
capturing, by one or more processors, a proposed database query input into a user interface;
providing, by the one or more processors, the proposed database query to a machine-learning model, wherein the machine-learning model has been trained, using one or more gathered and/or simulated sets of query execution overhead data and one or more gathered and/or simulated sets of database queries, to determine a potential execution overhead of a database query and output a query execution score;
outputting, by the machine-learning model, the query execution score based on the proposed database query;
determining, by the one or more processors, that the query execution score exceeds a query execution score threshold; and
triggering, by the one or more processors, a corrective action based on the query execution score exceeding the query execution score threshold.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, further comprising:
obtaining an execution overhead resulting from executing the proposed database query; and
retraining the machine-learning model using the proposed database query and the execution overhead.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein the potential execution overhead comprises a predicted query workload placed upon a database system.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein triggering the corrective action comprises:
blocking, by the one or more processors, the proposed database query from being executed.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein triggering the corrective action comprises:
identifying, by a natural language processor, one or more of a database update command or a database information request of the proposed database query; and
generating, by the natural language processor, an optimized database query including the one or more of the database update command and the database information request.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein triggering the corrective action comprises:
determining, by the one or more processors, that a threshold number of query execution scores exceeding the query execution score threshold has been reached; and
outputting, by the one or more processors, one or more sets of user training outputs to the user interface.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, further comprising:
recording, by the one or more processors, data associated with a unique user that input the proposed database query into the user interface.

### Claim 8

A computer-implemented method comprising:
providing, by one or more processors, a proposed database query to a machine-learning model, wherein the machine-learning model has been trained, using one or more gathered and/or simulated sets of query execution overhead data and one or more gathered and/or simulated sets of database queries, to determine a potential execution overhead of a database query and output a query execution score;
outputting, by the machine-learning model, the query execution score based on the proposed database query;
determining, by the one or more processors, that the query execution score exceeds a query execution score threshold;
identifying, by a natural language processor, one or more of a database update command or a database information request of the proposed database query; and
generating, by the natural language processor, an optimized database query including the one or more of the database update command and the database information request.

### Claim 9 (depends on 8)

The computer-implemented method of claim 8, further comprising:
obtaining an execution overhead resulting from executing the proposed database query; and
retraining the machine-learning model using the proposed database query and the execution overhead.

### Claim 10 (depends on 8)

The computer-implemented method of claim 8, wherein the potential execution overhead comprises a predicted query workload placed upon a database system.

### Claim 11 (depends on 8)

The computer-implemented method of claim 8, further comprising:
outputting the optimized database query to a user interface.

### Claim 12 (depends on 8)

The computer-implemented method of claim 8, further comprising:
determining, by the one or more processors, that a threshold number of query execution scores exceeding the query execution score threshold has been reached; and
outputting, by the one or more processors, one or more sets of user training outputs to a user interface.

### Claim 13

A system comprising:
a memory storing instructions and a machine-learning model that has been trained to find associations between one or more gathered and/or simulated sets of query execution overhead data and one or more gathered and/or simulated sets of database queries to determine a potential execution overhead of a database query and output a query execution score; and
a processor operatively connected to the memory and configured to execute the instructions to perform operations including:
capturing, by one or more processors, a proposed database query input into a user interface;
providing, by the one or more processors, the proposed database query to the machine-learning model;
outputting, by the machine-learning model, the query execution score based on the proposed database query;
determining, by the one or more processors, that the query execution score exceeds a query execution score threshold; and
triggering, by the one or more processors, a corrective action based on the query execution score exceeding the query execution score threshold.

### Claim 14 (depends on 13)

The system of claim 13, the operations further comprising:
obtaining an execution overhead resulting from executing the proposed database query; and
retraining the machine-learning model using the proposed database query and the execution overhead.

### Claim 15 (depends on 13)

The system of claim 13, wherein the potential execution overhead comprises a predicted query workload placed upon a database system.

### Claim 16 (depends on 13)

The system of claim 13, wherein triggering the corrective action comprises:
blocking, by the one or more processors, the proposed database query from being executed.

### Claim 17 (depends on 13)

The system of claim 13, further comprising a natural language processor.

### Claim 18 (depends on 17)

The system of claim 17, wherein triggering the corrective action comprises:
identifying, by the natural language processor, one or more of a database update command or a database information request of the proposed database query; and
generating, by the natural language processor, an optimized database query including the one or more of the database update command and the database information request.

### Claim 19 (depends on 13)

The system of claim 13, wherein triggering the corrective action comprises:
determining, by the processor, that a threshold number of query execution scores exceeding the query execution score threshold has been reached; and
outputting, by the processor, one or more sets of user training outputs to the user interface.

### Claim 20 (depends on 13)

The system of claim 13, the operations further comprising:
recording, by the processor, data associated with a unique user that input the proposed database query into the user interface.
