On The Reasonable Effectiveness of Relational Diagrams: Explaining Relational Query Patterns and the Pattern Expressiveness of Relational Languages
Wolfgang Gatterbauer, Cody Dunne
Abstract
Comparing relational languages by their logical expressiveness is well understood. Less well understood is how to compare relational languages by their ability to represent relational query patterns. Indeed, what are query patterns other than "a certain way of writing a query"? And how can query patterns be defined across procedural and declarative languages, irrespective of their syntax? To the best of our knowledge, we provide the first semantic definition of relational query patterns by using a variant of structure-preserving mappings between the relational tables of queries. This formalism allows us to analyze the relative pattern expressiveness of relational language fragments and create a hierarchy of languages with equal logical expressiveness yet different pattern expressiveness. Notably, for the non-disjunctive language fragment, we show that relational calculus can express a larger class of patterns than the basic operators of relational algebra.
Our language-independent definition of query patterns opens novel paths for assisting database users. For example, these patterns could be leveraged to create visual query representations that faithfully represent query patterns, speed up interpretation, and provide visual feedback during query editing. As a concrete example, we propose Relational Diagrams, a complete and sound diagrammatic representation of safe relational calculus that is provably (𝑖) unambiguous, (𝑖𝑖) relationally complete, and (𝑖𝑖𝑖) able to represent all query patterns for unions of non-disjunctive queries. Among all diagrammatic representations for relational queries that we are aware of, ours is the only one with these three properties. Furthermore, our anonymously preregistered user study shows that Relational Diagrams allow users to recognize patterns meaningfully faster and more accurately than SQL.
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 66a6d16b-16b5-42ba-938a-605d0b67caa0Cited by top-tier papers2
- A Principled Solution to the Disjunction Problem of Diagrammatic Query RepresentationsWolfgang GatterbauerSIGMOD 2026 · 5 citations
- Exploring Exploratory QueryingMarcelo Arenas, Enrico Franconi, Janik Hammerer, Olaf Hartig et al.VLDB 2025
Builds on3
- QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries FasterAristotelis Leventidis, Jiahui Zhang, Cody Dunne, Wolfgang Gatterbauer et al.SIGMOD 2020 · 36 citations
- Troubles with Nulls, Views from the UsersEtienne Toussaint, Paolo Guagliardo, Leonid Libkin, Juan SequedaVLDB 2022 · 31 citations
- STRATISFIMAL LAYOUT: A modular optimization model for laying out layered node-link network visualizationsSara Di Bartolomeo, Mirek Riedewald, Wolfgang Gatterbauer, Cody DunneIEEE VIS 2021 · 25 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
- Towards a Converged Relational-Graph Optimization FrameworkYunkai Lou, Longbin Lai, Bingqing Lyu, Yufan Yang et al.SIGMOD 2025 · 4 citations
- Understanding Queries by Conditional InstancesAmir Gilad, Zhengjie Miao, Sudeepa Roy, Jun YangSIGMOD 2022 · 9 citations
- GQL and SQL/PGQ: Theoretical Models and Expressive PowerAmélie Gheerbrant, Leonid Libkin, Liat Peterfreund, Alexandra RogovaVLDB 2025 · 16 citations
