Optimizing Nested Recursive Queries
Amir Shaikhha, Dan Suciu, Maximilian Schleich, Hung Q. Ngo
Abstract
MAXIMILIAN SCHLEICH, RelationalAI, USA HUNG NGO, RelationalAI, USA Datalog is a declarative programming language that has gained popularity in various domains due to its simplicity, expressiveness, and eciency. But "pure" Datalog is limited to monotone queries, and cannot be used in most practical applications. For that reason, newer systems are relaxing the language by allowing non-monotone queries to be freely combined with recursion. But by departing from the elegant xpoint semantics of pure datalog, these systems often result in inecient query execution, for example they perform redundant computations, or use redundant storage. In this paper, we propose Temporel, a system that allows recursion to be freely combined with non-monotone operators. Temporel optimizes the program by compiling it into a novel intermediate representation that we call TempoDL. Our experimental results show that our system outperforms a state-of-the-art Datalog engine as well as a vectorized and a compiled in-memory database system for a wide range of applications from machine learning to graph processing.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
3 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Optimizing Tensor Programs on Flexible Storage cites Functional collection programming with semi-ring dictionaries
- PyTond: Efficient Python Data Science on the Shoulders of Databases cites Optimizing Tensor Programs on Flexible Storage
- PyTond: Efficient Python Data Science on the Shoulders of Databases cites One WITH RECURSIVE is Worth Many GOTOs
- PyTond: Efficient Python Data Science on the Shoulders of Databases cites Functional collection programming with semi-ring dictionaries
Cited by top-tier papers3
- PyTond: Efficient Python Data Science on the Shoulders of DatabasesHesam Shahrokhi, Amirali Kaboli, Mahdi Ghorbani, Amir ShaikhhaICDE 2024 · 4 citations
- Flo: A Semantic Foundation for Progressive Stream ProcessingShadaj Laddad, Alvin Cheung, Joseph M. Hellerstein, Mae MilanoPOPL 2025 · 3 citations
- FlowLog: Efficient and Extensible Datalog via IncrementalityHangdong Zhao, Zhenghong Yu, Srinag Rao, Simon Frisk et al.VLDB 2026
Builds on6
- Functional collection programming with semi-ring dictionariesAmir Shaikhha, Mathieu Huot, Jaclyn Smith, Dan OlteanuOOPSLA 2022 · 31 citations
- Optimizing Tensor Programs on Flexible StorageMaximilian Schleich, Amir Shaikhha, Dan SuciuSIGMOD 2023 · 21 citations
- Automating Incremental and Asynchronous Evaluation for Recursive Aggregate Data ProcessingQiange Wang, Yanfeng Zhang, Hao Wang, Liang Geng et al.SIGMOD 2020 · 21 citations
- One WITH RECURSIVE is Worth Many GOTOsDenis Hirn, Torsten GrustSIGMOD 2021 · 19 citations
- Functional-Style SQL UDFs With a Capital 'F'Christian Duta, Torsten GrustSIGMOD 2020 · 11 citations
Related papers
- Optimizing Parallel Recursive Datalog Evaluation on Multicore MachinesJiacheng Wu, Jin Wang, Carlo ZanioloSIGMOD 2022 · 9 citations
- On the Optimization of Recursive Relational Queries: Application to Graph QueriesLouis Jachiet, Pierre Genevès, Nils Gesbert, Nabil LayaïdaSIGMOD 2020 · 31 citations
- iTemporal: An Extensible Generator of Temporal BenchmarksLuigi Bellomarini, Markus Nissl, Emanuel SallingerICDE 2022 · 7 citations
- Optimizing Datalog for the GPUYihao Sun, Ahmedur Rahman Shovon, Thomas Gilray, Sidharth Kumar et al.ASPLOS 2025 · 3 citations
- Optimizing Recursive Queries with Progam SynthesisYisu Remy Wang, Mahmoud Abo Khamis, Hung Q. Ngo, Reinhard Pichler et al.SIGMOD 2022 · 9 citations
