Synthesizing analytical SQL queries from computation demonstration
Xiangyu Zhou, Rastislav Bodík, Alvin Cheung, Chenglong Wang
Abstract
Analytical SQL is widely used in modern database applications and data analysis. However, its partitioning and grouping operators are challenging for novice users. Unfortunately, programming by example, shown effective on standard SQL, are less attractive because examples for analytical queries are more laborious to solve by hand.
To make demonstrations easier to create, we designed a new end-user specification, programming by computation demonstration, that allows the user to demonstrate the task using a (possibly incomplete) cell-level computation trace. This specification is exploited in a new abstraction-based synthesis algorithm to prove that a partially formed query cannot be completed to satisfy the specification, allowing us to prune the search space.
We implemented our approach in a tool named Sickle and tested it on 80 real-world analytical SQL tasks. Results show that even from small demonstrations, Sickle can solve 76 tasks, in 12.8 seconds on average, while the prior approaches can solve only 60 tasks and are on average 22.5× slower. Our user study with 13 participants reveals that our specification increases user efficiency and confidence on challenging tasks.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 52c4261b-10d8-45c4-9c81-a39c55e26049Cited by top-tier papers6
- Grounded Copilot: How Programmers Interact with Code-Generating ModelsShraddha Barke, Michael B. James, Nadia PolikarpovaOOPSLA 2023 · 408 citations
- ImageEye: Batch Image Processing using Program SynthesisCeleste Barnaby, Qiaochu Chen, Roopsha Samanta, Isil DilligPLDI 2023 · 13 citations
- SlabCity: Whole-Query Optimization using Program SynthesisRui Dong, Jie Liu, Yuxuan Zhu, Cong Yan et al.VLDB 2023 · 11 citations
- Relational Query Synthesis ⋈ Decision Tree LearningAaditya Naik, Aalok Thakkar, Adam Stein, Rajeev Alur et al.VLDB 2024 · 2 citations
- Refinement Types for VisualizationJingtao Xia, Junrui Liu, Nicholas Brown, Yanju Chen et al.ASE 2024 · 1 citation
Builds on11
- egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt et al.POPL 2021 · 170 citations
- Provenance-guided synthesis of Datalog programsMukund Raghothaman, Jonathan Mendelson, David Zhao, Mayur Naik et al.POPL 2020 · 49 citations
- Small-Step Live Programming by ExampleKasra Ferdowsifard, Allen Ordookhanians, Hila Peleg, Sorin Lerner et al.UIST 2020 · 40 citations
- Visualization by exampleChenglong Wang, Yu Feng, Rastislav Bodík, Alvin Cheung et al.POPL 2020 · 36 citations
- Falx: Synthesis-Powered Visualization AuthoringChenglong Wang, Yu Feng, Rastislav Bodík, Isil Dillig et al.CHI 2021 · 35 citations
Related papers
- PATSQL: Efficient Synthesis of SQL Queries from Example Tables with Quick Inference of Projected ColumnsKeita Takenouchi, Takashi Ishio, Joji Okada, Yuji SakataVLDB 2021 · 19 citations
- Synthesizing Graph Queries from DemonstrationsXiaoyu Liu, Qikang Liu, Evan Dyce, Keval Vora et al.OOPSLA 2026
- Example-guided synthesis of relational queriesAalok Thakkar, Aaditya Naik, Nathaniel Sands, Rajeev Alur et al.PLDI 2021 · 12 citations
- Interactive Text-to-SQL Generation via Editable Step-by-Step ExplanationsYuan Tian, Zheng Zhang, Zheng Ning, Toby Jia-Jun Li et al.EMNLP 2023 · 14 citations
- Fast and Reliable Program Synthesis via User InteractionYanju Chen, Chenglong Wang, Xinyu Wang, Osbert Bastani et al.ASE 2023 · 5 citations
