- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Workload-aware SQL query recommendation using retrieval-augmented...
Open Collections
UBC Theses and Dissertations
UBC Theses and Dissertations
Workload-aware SQL query recommendation using retrieval-augmented generation Soltan Aghai, Ehsan
Abstract
Writing effective SQL queries remains a major obstacle for non-expert users who need to explore and analyze data. While recent advances in deep learning have enabled limited forms of SQL query recommendation, existing systems typically focus on predicting partial query structures or rely on schema-specific features. In this thesis, we present a retrieval-augmented generation (RAG) framework for recommending full SQL queries based solely on previous user queries in a session. At the core of our approach is a transition-aware dual encoder trained to retrieve the most likely next query template by capturing both semantic similarity and structural transitions across queries. This retrieval is followed by a language model that generates the full SQL query, conditioned on the retrieved template, recent query history. Our method requires no access to the database schema and adapts naturally to evolving workloads. Compared to traditional rule-based or collaborative recommendation systems, it offers a more flexible and interpretable solution that models user behavior over time. Empirical results show that our system produces contextually relevant queries, improving usability for users with limited SQL experience.
Item Metadata
Title |
Workload-aware SQL query recommendation using retrieval-augmented generation
|
Creator | |
Supervisor | |
Publisher |
University of British Columbia
|
Date Issued |
2025
|
Description |
Writing effective SQL queries remains a major obstacle for non-expert users who need to explore and analyze data. While recent advances in deep learning have enabled limited forms of SQL query recommendation, existing systems typically focus on predicting partial query structures or rely on schema-specific features. In this thesis, we present a retrieval-augmented generation (RAG) framework for recommending full SQL queries based solely on previous user queries in a session. At the core of our approach is a transition-aware dual encoder trained to retrieve the most likely next query template by capturing both semantic similarity and structural transitions across queries. This retrieval is followed by a language model that generates the full SQL query, conditioned on the retrieved template, recent query history. Our method requires no access to the database schema and adapts naturally to evolving workloads. Compared to traditional rule-based or collaborative recommendation systems, it offers a more flexible and interpretable solution that models user behavior over time. Empirical results show that our system produces contextually relevant queries, improving usability for users with limited SQL experience.
|
Genre | |
Type | |
Language |
eng
|
Date Available |
2025-04-25
|
Provider |
Vancouver : University of British Columbia Library
|
Rights |
Attribution-NonCommercial-NoDerivatives 4.0 International
|
DOI |
10.14288/1.0448564
|
URI | |
Degree | |
Program | |
Affiliation | |
Degree Grantor |
University of British Columbia
|
Graduation Date |
2025-05
|
Campus | |
Scholarly Level |
Graduate
|
Rights URI | |
Aggregated Source Repository |
DSpace
|
Item Media
Item Citations and Data
Rights
Attribution-NonCommercial-NoDerivatives 4.0 International