# US 2025/0165473 A1 · Efficiently capturing statistics on long running queries

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

- Number: US 2025/0165473 A1
- Document ID: US20250165473A1
- Status: Published application
- Kind: A1
- Application number: 18/515,162
- Filed: 2023-11-20
- Published: 2025-05-22
- Earliest claimed: 2023-11-20
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: SUZHEN LIN; Edwin Howard Jacox, JR.
- Web page: https://patentgrep.com/patent/US20250165473A1

## CPC

- G06F 16/217: {Database tuning (G06F16/2282 takes precedence; database performance monitoring G06F11/3409)}
- G06F 16/24552: {Database cache management}
- G06F 11/3419: {by assessing time}
- G06F 16/2453: Query optimisation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method for efficiently capturing statistics on long running queries includes obtaining a query and obtaining a linked list including a plurality of records, each record in the plurality of records including respective query execution statistics. The method includes executing the query and, during execution of the query, obtaining new query execution statistics associated with the executing query. The method includes creating a new record in the linked list, the new record including the new query execution statistics. The method includes determining that a query execution duration of the query satisfies a query execution threshold. Further, the method includes identifying each record in the linked list that corresponds to the query. The method includes storing, for each respective identified record in the linked list that corresponds to the query, the respective query execution statistics of the respective identified record in a statistics database.

## Claims

### Claim 1

A computer-implemented method executed by data processing hardware that causes the data processing hardware to perform operations comprising:
obtaining a query corresponding to data at a data store;
obtaining a linked list, the linked list comprising a plurality of records, each record in the plurality of records comprising respective query execution statistics;
executing, using a query executor, the query;
during execution of the query by the query executor, obtaining new query execution statistics representing execution performance of the query executor while executing the query;
creating a new record in the linked list, the new record comprising the new query execution statistics;
determining that a query execution duration of the query satisfies a query execution threshold;
in response to determining that the query execution duration of the query satisfies the query execution threshold, identifying each record in the linked list that corresponds to the query; and
storing, for each respective identified record in the linked list that corresponds to the query, the respective query execution statistics of the respective identified record in a statistics database.

### Claim 2 (depends on 1)

The method of claim 1, wherein the operations further comprise, in response to storing the respective query execution statistics of the respective identified record in the statistics database, deleting each identified record from the linked list.

### Claim 3 (depends on 1)

The method of claim 1, wherein the operations further comprise:
obtaining a second query corresponding to the data at the data store;
executing the second query;
during execution of the second query, obtaining second new query execution statistics;
creating a second new record in the linked list, the second new record comprising the second new query execution statistics;
determining that a second query execution duration of the second query fails to satisfy the query execution threshold; and
in response to determining that the second query execution duration of the second query fails to satisfy the query execution threshold, deleting the second new record from the linked list.

### Claim 4 (depends on 1)

The method of claim 1, wherein the new query execution statistics comprises one or more of:
query processing statistics;
wait event statistics;
query statistics; or
plan statistics.

### Claim 5 (depends on 1)

The method of claim 1, wherein the operations further comprise, in response to executing the query, creating a start record in a start list, the start record comprising a start time of the query.

### Claim 6 (depends on 5)

The method of claim 5, wherein the operations further comprise, determining, based on the start record and a current time, the query execution duration for the query.

### Claim 7 (depends on 5)

The method of claim 5, wherein the operations further comprise, in response to completing execution of the query, creating an end record in an end list, the end record comprising an end execution time of the query.

### Claim 8 (depends on 7)

The method of claim 7, wherein the operations further comprise, determining, based on the end record and the start record, the query execution duration for the query.

### Claim 9 (depends on 1)

The method of claim 1, wherein:
obtaining the new query execution statistics comprises retrieving the new query execution statistics from a shared memory of a query execution environment.

### Claim 10 (depends on 1)

The method of claim 1, wherein the operations further comprise transmitting, to a client device, a portion of the new query execution statistics that, when received by the client device, causes the client device to display the portion of the new query execution statistics via a user-interface of the client device.

### Claim 11

A system comprising:
data processing hardware; and
memory hardware in communication with the data processing hardware, the memory hardware storing instructions that, when executed on the data processing hardware, cause the data processing hardware to perform operations comprising:
obtaining a query corresponding to data at a data store;
obtaining a linked list, the linked list comprising a plurality of records, each record in the plurality of records comprising respective query execution statistics;
executing, using a query executor, the query;
during execution of the query by the query executor, obtaining new query execution statistics representing execution performance of the query executor while executing the query;
creating a new record in the linked list, the new record comprising the new query execution statistics;
determining that a query execution duration of the query satisfies a query execution threshold;
in response to determining that the query execution duration of the query satisfies the query execution threshold, identifying each record in the linked list that corresponds to the query; and
storing, for each respective identified record in the linked list that corresponds to the query, the respective query execution statistics of the respective identified record in a statistics database.

### Claim 12 (depends on 11)

The system of claim 11, wherein the operations further comprise, in response to storing the respective query execution statistics of the respective identified record in the statistics database, deleting each identified record from the linked list.

### Claim 13 (depends on 11)

The system of claim 11, wherein the operations further comprise:
obtaining a second query corresponding to the data at the data store;
executing the second query;
during execution of the second query, obtaining second new query execution statistics;
creating a second new record in the linked list, the second new record comprising the second new query execution statistics;
determining that a second query execution duration of the second query fails to satisfy the query execution threshold; and
in response to determining that the second query execution duration of the second query fails to satisfy the query execution threshold, deleting the second new record from the linked list.

### Claim 14 (depends on 11)

The system of claim 11, wherein the new query execution statistics comprises one or more of:
query processing statistics;
wait event statistics;
query statistics; or
plan statistics.

### Claim 15 (depends on 11)

The system of claim 11, wherein the operations further comprise, in response to executing the query, creating a start record in a start list, the start record comprising a start time of the query.

### Claim 16 (depends on 15)

The system of claim 15, wherein the operations further comprise determining, based on the start record and a current time, the query execution duration for the query.

### Claim 17 (depends on 15)

The system of claim 15, wherein the operations further comprise, in response to completing execution of the query, creating an end record in an end list, the end record comprising an end execution time of the query.

### Claim 18 (depends on 17)

The system of claim 17, wherein the operations further comprise determining, based on the end record and the start record, the query execution duration for the query.

### Claim 19 (depends on 11)

The system of claim 11, wherein:
obtaining the new query execution statistics comprises retrieving the new query execution statistics from a shared memory of a query execution environment.

### Claim 20 (depends on 11)

The system of claim 11, wherein the operations further comprise transmitting, to a client device, a portion of the new query execution statistics that, when received by the client device, causes the client device to display the portion of the new query execution statistics via a user-interface of the client device.
