TY - JOUR
T1 - Evaluation of Machine Learning Algorithms in Predicting the Next SQL Query from the Future
AU - Meduri, Venkata Vamsikrishna
AU - Chowdhury, Kanchan
AU - Sarwat, Mohamed
N1 - Funding Information:
This work was supported by the National Science Foundation (NSF) under Grant 1845789. Authors’ addresses: V. V. Meduri, K. Chowdhury, M. Sarwat, Arizona State University, 699 South Mill Avenue, CIDSE, Brickyard Engineering, Tempe, AZ 85281; emails: {vmeduri, kchowdh1, msarwat}@asu.edu. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. © 2021 Association for Computing Machinery. 0362-5915/2021/03-ART4 $15.00 https://doi.org/10.1145/3442338
Publisher Copyright:
© 2021 ACM.
PY - 2021/4
Y1 - 2021/4
N2 - Prediction of the next SQL query from the user, given her sequence of queries until the current timestep, during an ongoing interaction session of the user with the database, can help in speculative query processing and increased interactivity. While existing machine learning-(ML) based approaches use recommender systems to suggest relevant queries to a user, there has been no exhaustive study on applying temporal predictors to predict the next user issued query. In this work, we experimentally compare ML algorithms in predicting the immediate next future query in an interaction workload, given the current user query or the sequence of queries in a user session thus far. As a part of this, we propose the adaptation of two powerful temporal predictors: (a) Recurrent Neural Networks (RNNs) and (b) a Reinforcement Learning approach called Q-Learning that uses Markov Decision Processes. We represent each query as a comprehensive set of fragment embeddings that not only captures the SQL operators, attributes, and relations but also the arithmetic comparison operators and constants that occur in the query. Our experiments on two real-world datasets show the effectiveness of temporal predictors against the baseline recommender systems in predicting the structural fragments in a query w.r.t. both quality and time. Besides showing that RNNs can be used to synthesize novel queries, we find that exact Q-Learning outperforms RNNs despite predicting the next query entirely from the historical query logs.
AB - Prediction of the next SQL query from the user, given her sequence of queries until the current timestep, during an ongoing interaction session of the user with the database, can help in speculative query processing and increased interactivity. While existing machine learning-(ML) based approaches use recommender systems to suggest relevant queries to a user, there has been no exhaustive study on applying temporal predictors to predict the next user issued query. In this work, we experimentally compare ML algorithms in predicting the immediate next future query in an interaction workload, given the current user query or the sequence of queries in a user session thus far. As a part of this, we propose the adaptation of two powerful temporal predictors: (a) Recurrent Neural Networks (RNNs) and (b) a Reinforcement Learning approach called Q-Learning that uses Markov Decision Processes. We represent each query as a comprehensive set of fragment embeddings that not only captures the SQL operators, attributes, and relations but also the arithmetic comparison operators and constants that occur in the query. Our experiments on two real-world datasets show the effectiveness of temporal predictors against the baseline recommender systems in predicting the structural fragments in a query w.r.t. both quality and time. Besides showing that RNNs can be used to synthesize novel queries, we find that exact Q-Learning outperforms RNNs despite predicting the next query entirely from the historical query logs.
KW - Query prediction
KW - recommender systems
KW - recurrent neural networks
KW - schema-Aware SQL embeddings
UR - http://www.scopus.com/inward/record.url?scp=85104204807&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85104204807&partnerID=8YFLogxK
U2 - 10.1145/3442338
DO - 10.1145/3442338
M3 - Article
AN - SCOPUS:85104204807
SN - 0362-5915
VL - 46
JO - ACM Transactions on Database Systems
JF - ACM Transactions on Database Systems
IS - 1
M1 - 4
ER -