# US 2024/0004879 A1 · Dynamically substituting a modified query based on performance analysis

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

- Number: US 2024/0004879 A1
- Document ID: US20240004879A1
- Status: Published application
- Kind: A1
- Application number: 17/823,060
- Filed: 2022-08-29
- Published: 2024-01-04
- Earliest claimed: 2022-07-01
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Ganapathi SADASIVAM; Andres MARTINEZ ANDRADE; Kishore Kumar PENUGONDA; Yanli TONG
- Web page: https://patentgrep.com/patent/US20240004879A1

## CPC

- G06F 16/24534: {Query rewriting; Transformation}
- G06F 16/24549: {Run-time optimisation}
- G06F 16/242: Query formulation
- G06F 16/24542: {Plan optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The disclosure herein describes analyzing queries and dynamically modifying those queries based on the analysis. An indication that a query is to be executed by a first process is detected. It is determined that an analysis results data store does not include an active analysis result for the query using a query identifier of the query and, as a result, a modified instance of the query is generated using a modification pattern. The query and the modified instance of the query are analyzed based on a performance metric using a second process that is independent of the first process. An active analysis result of the query is recorded based on the analysis, wherein the analysis result indicates whether future executions of the query should be modified using the modification pattern. Further, in some examples, analysis results expire, such that associated queries are reanalyzed to generate active analysis results periodically.

## Claims

### Claim 1

A system comprising:
a processor; and
a memory comprising computer program code, the memory and the computer program code configured to, with the processor, cause the processor to:
detect an indication that a query is to be executed by a first process;
determine that an analysis results data store does not include an active analysis result for the query using a query identifier of the query;
generate a modified instance of the query using a modification pattern;
analyze the query and the modified instance of the query based at least in part on a performance metric using a second process independent of the first process; and
record an active analysis result for the query in the analysis results data store, wherein the active analysis result indicates whether future executions of the query should be modified using the modification pattern based at least in part on a result of analyzing the query.

### Claim 2 (depends on 1)

The system of claim 1, wherein the memory and the computer program code are configured to, with the processor, further cause the processor to:
execute the query in a default mode using the first process based at least in part on determining that the analysis results data store does not include an active analysis result for the query; and
add the query to an analysis queue, wherein analyzing the query is based at least in part on the query reaching a front of the analysis queue.

### Claim 3 (depends on 1)

The system of claim 1, wherein the memory and the computer program code are configured to, with the processor, further cause the processor to:
detect another indication that the query is to be executed;
determine that the analysis results data store includes the active analysis result for the query, wherein the active analysis result indicates that the query should be modified using the modification pattern;
modify the query using the modification pattern; and
execute the modified query.

### Claim 4 (depends on 1)

The system of claim 1, wherein the recorded active analysis result in the analysis results data store includes an expiration time, wherein the expiration time is defined based at least in part on an active result time interval, and wherein the active analysis result becomes inactive at the expiration time.

### Claim 5 (depends on 1)

The system of claim 1, wherein the analysis results data store is associated with a customer entity associated with the query to be executed, such that all analysis results in the analysis results data store are associated with the customer entity.

### Claim 6 (depends on 1)

The system of claim 1, wherein the performance metric is a quantity of time taken to complete execution.

### Claim 7 (depends on 1)

The system of claim 1, wherein the modification pattern includes adding a statement to the query to limit a quantity of results generated by the query.

### Claim 8

A computerized method comprising:
detecting an indication that a query is to be executed by a first process;
determining that an analysis results data store does not include an active analysis result for the query using a query identifier of the query;
generating a modified instance of the query using a modification pattern;
analyzing the query and the modified instance of the query based at least in part on a performance metric using a second process independent of the first process; and
recording an active analysis result for the query in the analysis results data store, wherein the active analysis result indicates whether future executions of the query should be modified using the modification pattern based at least in part on a result of analyzing the query.

### Claim 9 (depends on 8)

The computerized method of claim 8, further comprising:
executing the query in a default mode using the first process based at least in part on determining that the analysis results data store does not include an active analysis result for the query; and
adding the query to an analysis queue, wherein analyzing the query is based at least in part on the query reaching a front of the analysis queue.

### Claim 10 (depends on 8)

The computerized method of claim 8, further comprising:
detecting another indication that the query is to be executed;
determining that the analysis results data store includes the active analysis result for the query, wherein the active analysis result indicates that the query should be modified using the modification pattern;
modifying the query using the modification pattern; and
executing the modified query.

### Claim 11 (depends on 8)

The computerized method of claim 8, wherein the recorded active analysis result in the analysis results data store includes an expiration time, wherein the expiration time is defined based at least in part on an active result time interval, and wherein the active analysis result becomes inactive at the expiration time.

### Claim 12 (depends on 8)

The computerized method of claim 8, wherein the analysis results data store is associated with a customer entity associated with the query to be executed, such that all analysis results in the analysis results data store are associated with the customer entity.

### Claim 13 (depends on 8)

The computerized method of claim 8, wherein the performance metric is a quantity of time taken to complete execution.

### Claim 14 (depends on 8)

The computerized method of claim 8, wherein the modification pattern includes adding a statement to the query to limit a quantity of results generated by the query.

### Claim 15

One or more computer storage media having computer-executable instructions that, upon execution by a processor, cause the processor to at least:
detect an indication that a query is to be executed by a first process;
determine that an analysis results data store does not include an active analysis result for the query using a query identifier of the query;
generate a modified instance of the query using a modification pattern;
analyze the query and the modified instance of the query based at least in part on a performance metric using a second process independent of the first process; and
record an active analysis result for the query in the analysis results data store, wherein the active analysis result indicates whether future executions of the query should be modified using the modification pattern based at least in part on a result of analyzing the query.

### Claim 16 (depends on 15)

The one or more computer storage media of claim 15, wherein the computer-executable instructions, upon execution by a processor, further cause the processor to at least:
execute the query in a default mode using the first process based at least in part on determining that the analysis results data store does not include an active analysis result for the query; and
add the query to an analysis queue, wherein analyzing the query is based at least in part on the query reaching a front of the analysis queue.

### Claim 17 (depends on 15)

The one or more computer storage media of claim 15, wherein the computer-executable instructions, upon execution by a processor, further cause the processor to at least:
detect another indication that the query is to be executed;
determine that the analysis results data store includes the active analysis result for the query, wherein the active analysis result indicates that the query should be modified using the modification pattern;
modify the query using the modification pattern; and
execute the modified query.

### Claim 18 (depends on 15)

The one or more computer storage media of claim 15, wherein the recorded active analysis result in the analysis results data store includes an expiration time, wherein the expiration time is defined based at least in part on an active result time interval, and wherein the active analysis result becomes inactive at the expiration time.

### Claim 19 (depends on 15)

The one or more computer storage media of claim 15, wherein the analysis results data store is associated with a customer entity associated with the query to be executed, such that all analysis results in the analysis results data store are associated with the customer entity.

### Claim 20 (depends on 15)

The one or more computer storage media of claim 15, wherein the performance metric is a quantity of time taken to complete execution.
