QPSEncoder: A Database Workload Encoder with Deep Learning
摘要
Machine learning has become a prominent approach for many database optimization problems, including cost estimation, cardinality estimation, and query optimization. However, the task of feature selection and encoding for machine learning in database tasks presents significant challenges. Recently, some representation methods have been proposed that utilize physical plan or SQL query as feature. However, these methods have two limitations. Firstly, they often rely on the selection of workloads using either the physical plan or the SQL query alone, which is not comprehensive enough to fully represent the characteristics of the database. Secondly, early feature extraction and encoding methods are not applicable to the database workload. To tackle these limitations, we propose PQSEncoder, a feature representation model designed to address various database optimization challenges. In this approach, we integrate the physical plan, SQL query, and database schema to construct the workload of the database. Feature extraction and encoding are performed for each type, followed by feature fusion to compose the workload’s features, which can then be used for machine learning tasks in database optimization. We incorporate PQSEncoder into two machine learning models for database optimization tasks, and experimental results show that PQSEncoder substantially improves the performance of these models.