IP Library › Granted Patent US 11,727,004
Granted Patent B2
US 11,727,004 · App. 17/662,623 · Granted Aug 15, 2023

Context dependent execution time prediction for redirecting queries

Inventors: Mingda Li (Los Angeles, CA); Gaurav Saxena (Cupertino, CA); Naresh Chainani (Mountain View, CA)
Assignee: Amazon Technologies, Inc.
G06F16/24549G06N5/04G06N20/00
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,727,004
App. No.
17/662,623
Granted
Aug 15, 2023
Kind
B2
Abstract

Context dependent execution time prediction may be applied to redirect queries to additional query processing resources. A query to a database may be received at a first query engine. A prediction model for executing queries at the first query engine may be applied to determine predicted query execution time for the first query engine. A prediction model for executing queries at a second query engine may also be applied to determine predicted query execution time for the second query engine. One of the query engines may be selected to perform the query based on a comparison of the predicted query execution times.

Claims (39)

1. A system, comprising:

at least one processor; and

a memory, storing program instructions that when executed cause the at least one processor to implement a query engine;

the query engine, configured to:

perform a plurality of queries to a database;

store respective query plans generated to perform the plurality of queries and respective execution times for the plurality of queries;

cause a training technique to be applied to the stored respective query plans and respective execution times of the plurality of queries to train a machine learning model to predict execution times of queries performed by the query engine with respect to the database using a query plan generated for a given query as input to the machine learning model; and

select either the query engine or a different query engine to perform another query to the database based, at least in part, on an execution time prediction for the other query generated by the machine learning model at the query engine according to a query plan generated for the other query by the query engine.

2. The system of claim 1 , wherein the training technique is based on at least one of a linear learning algorithm or a non-linear learning algorithm.

3. The system of claim 1 , wherein selecting either the query engine or the different query engine to perform the other query to the database is further based on another execution time prediction for the other query generated by a machine learning model at the different query engine according to a query plan generated for the other query by the different query engine.

4. The system of claim 1 , wherein the database is stored as a part of a network-based data warehouse service that implements the query engine and the different query engine, wherein the different query engine accesses a copy of the database stored in a storage service through a format-independent data processing service, and wherein the different query engine is provisioned from a pool of query engines implemented for query processing.

5. A method, comprising:

performing a plurality of queries to a database;

storing respective query plans generated to perform the plurality of queries and respective execution times for the plurality of queries;

causing a training technique to be applied to the stored respective query plans and respective execution times of the plurality of queries to train a machine learning model to predict execution times of queries performed by the query engine with respect to the database using a query plan generated for a given query as input to the machine learning model; and

selecting either the query engine or a different query engine to perform another query to the database based, at least in part, on an execution time prediction for the other query generated by the machine learning model at the query engine according to a query plan generated for the other query by the query engine.

6. The method of claim 5 , wherein the training technique is based on at least one of a linear learning algorithm or a non-linear learning algorithm.

7. The method of claim 5 , wherein selecting either the query engine or the different query engine to perform the other query to the database is further based on another execution time prediction for the other query generated by a machine learning model at the different query engine according to a query plan generated for the other query by the different query engine.

8. The method of claim 5 , wherein selecting either the query engine or the different query engine to perform the other query to the database is based, at least in part, on whether the execution time prediction is within a range of predicted execution times for the other query generated by the machine learning model at the query engine according to the query plan generated for the other query by the query engine.

9. The method of claim 5 , wherein the execution time prediction is based on an expected wait time for the other query to be performed at each of the query engine and the other query engine.

10. The method of claim 9 , wherein the expected wait time is based on a number of available slots for performing the other query at each of the query engine and the other query engine.

11. The method of claim 9 , wherein the expected wait time is determined based on:

a quantity of queries waiting at the query engine and predicted execution time for respective queries of the quantity of queries waiting at the query engine; and

a workload at the query engine determined using a cumulative distribution function of the quantity of queries waiting at the query engine.

12. The method of claim 5 , wherein selecting either the query engine or the different query engine to perform the other query to the database is based, at least in part, on an initialization time for provisioning the different query engine.

13. The method of claim 5 , wherein the different query engine is one of a plurality of query engines that can perform queries to the database in addition to the query engine, and wherein respective prediction models for the plurality of query engines are applied to determine respective execution time predictions for the query at the plurality of query engines.

14. The method of claim 5 , wherein the query engine and the different query engine are implemented as part of a network-based service, and wherein the method further comprises provisioning the different query engine from a pool of query engines based, at least in part, on the execution time prediction for the other query generated by the machine learning model at the query engine according to the query plan generated for the other query by the query engine, wherein the pool of query engines is implemented as part of the network-based service for query performance.

15. One or more non-transitory, computer-readable storage media, storing program instructions that when executed on or across one or more computing devices cause the one or more computing devices to implement:

perform a plurality of queries to a database;

store respective query plans generated to perform the plurality of queries and respective execution times for the plurality of queries;

cause a training technique to be applied to the stored respective query plans and respective execution times of the plurality of queries to train a machine learning model to predict execution times of queries performed by the query engine with respect to the database using a query plan generated for a given query as input to the machine learning model; and

select either the query engine or a different query engine to perform another query to the database based, at least in part, on an execution time prediction for the other query generated by the machine learning model at the query engine according to a query plan generated for the other query by the query engine.

16. The one or more non-transitory, computer-readable storage media of claim 15 , wherein the training technique is based on at least one of a linear learning algorithm or a non-linear learning algorithm.

17. The one or more non-transitory, computer-readable storage media of claim 15 , wherein selecting either the query engine or the different query engine to perform the other query to the database is further based on another execution time prediction for the other query generated by a machine learning model at the different query engine according to a query plan generated for the other query by the different query engine.

18. The one or more non-transitory, computer-readable storage media of claim 15 , wherein the execution time prediction is based on an expected wait time for the other query to be performed at each of the query engine and the other query engine.

19. The one or more non-transitory, computer-readable storage media of claim 18 , wherein the expected wait time is based on a number of available slots for performing the other query at each of the query engine and the other query engine.

20. The one or more non-transitory, computer-readable storage media of claim 18 , wherein the expected wait time is determined based on:

a quantity of queries waiting at the query engine and predicted execution time for respective queries of the quantity of queries waiting at the query engine; and

a workload at the query engine determined using a cumulative distribution function of the quantity of queries waiting at the query engine.

Continuity (2)
Continuation 16364055 · Mar 25, 2019
Related Publication 20220269680A1 · Aug 25, 2022
Cited By (2)
US 12,248,473 US 12,602,382