QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries Faster
Aristotelis Leventidis, Jiahui Zhang, Cody Dunne, Wolfgang Gatterbauer, H. V. Jagadish, Mirek Riedewald
Abstract
Understanding the meaning of existing SQL queries is critical for code maintenance and reuse. Yet SQL can be hard to read, even for expert users or the original creator of a query. We conjecture that it is possible to capture the logical intent of queries in automatically-generated visual diagrams that can help users understand the meaning of queries faster and more accurately than SQL text alone. We present initial steps in that direction with visual diagrams that are based on the first-order logic foundation of SQL and can capture the meaning of deeply nested queries. Our diagrams build upon a rich history of diagrammatic reasoning systems in logic and were designed using a large body of human-computer interaction best practices: they are minimal in that no visual element is superfluous; they are unambiguous in that no two queries with different semantics map to the same visualization; and they extend previously existing visual representations of relational schemata and conjunctive queries in a natural way. An experimental evaluation involving 42 users on Amazon Mechanical Turk shows that with only a 2--3 minute static tutorial, participants could interpret queries meaningfully faster with our diagrams than when reading SQL alone. Moreover, we have evidence that our visual diagrams result in participants making fewer errors than with SQL. We believe that more regular exposure to diagrammatic representations of SQL can give rise to a pattern-based and thus more intuitive use and re-use of SQL. A full version of this paper with all appendices and supplemental material for the experimental study (stimuli, raw data, and analysis code) are available at https://osf.io/btszh.
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 abd3c22d-6b93-4af3-b1e5-a4e109ca1283Cited by top-tier papers13
- Why Not Yet: Fixing a Top-k Ranking that Is Not Fair to IndividualsZixuan Chen, Panagiotis Manolios, Mirek RiedewaldVLDB 2023 · 17 citations
- SQLucid: Grounding Natural Language Database Queries with Interactive ExplanationsYuan Tian, Jonathan K. Kummerfeld, Toby Jia-Jun Li, Tianyi ZhangUIST 2024 · 13 citations
- NOAH: Interactive Spreadsheet Exploration with Dynamic Hierarchical OverviewsSajjadur Rahman, Mangesh Bendre, Yuyang Liu, Shichu Zhu et al.VLDB 2021 · 11 citations
- Qr-Hint: Actionable Hints Towards Correcting Wrong SQL QueriesYihao Hu, Amir Gilad, Kristin Stephens-Martinez, Sudeepa Roy et al.SIGMOD 2024 · 7 citations
- On The Reasonable Effectiveness of Relational Diagrams: Explaining Relational Query Patterns and the Pattern Expressiveness of Relational LanguagesWolfgang Gatterbauer, Cody DunneSIGMOD 2024 · 6 citations
Related papers
- I-Rex: An Interactive Debugger for SQLYihao Hu, Zian Chen, Zhiming Leong, Sharan Sokhi et al.VLDB 2026
- 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
- Cerebra: Aligning Implicit Knowledge in Interactive SQL AuthoringYunfan Zhou, Qiming Shi, Zhongsu Luo, Xiwen Cai et al.CHI 2026 · 2 citations
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL TranslationHongwei Yuan, Xiu Tang, Ke Chen, Lidan Shou et al.AAAI 2025 · 12 citations
- Speak to your Parser: Interactive Text-to-SQL with Natural Language FeedbackAhmed Elgohary, Saghar Hosseini, Ahmed Hassan AwadallahACL 2020 · 13 citations
