Lune

OOPSLA2023Top-tier venue

Bring Your Own Data Structures to Datalog

Arash Sahebolamri, Langston Barrett, Scott Moore, Kristopher K. Micinski

Abstract

The restricted logic programming language Datalog has become a popular implementation target for deductiveanalytic workloads including social-media analytics and program analysis. Modern Datalog engines compile Datalog rules to joins over explicit representations of relations-often B-trees or hash maps. While these modern engines have enabled high scalability in many application domains, they have a crucial weakness: achieving the desired algorithmic complexity may be impossible due to representation-imposed overhead of the engine's data structures. In this paper, we present the "Bring Your Own Data Structures" (Byods) approach, in the form of a DSL embedded in Rust. Using Byods, an engineer writes logical rules which are implicitly parametric on the concrete data structure representation; our implementation provides an interface to enable "bringing their own" data structures to represent relations, which harmoniously interact with code generated by our compiler (implemented as Rust procedural macros). We formalize the semantics of Byods as an extension of Datalog's; our formalization captures the key properties demanded of data structures compatible with Byods, including properties required for incrementalized (semi-naïve) evaluation. We detail many applications of the Byods approach, implementing analyses requiring specialized data structures for transitive and equivalence relations to scale, including an optimized version of the Rust borrow checker Polonius; highly-parallel PageRank made possible by lattices; and a large-scale analysis of LLVM utilizing index-sharing to scale. Our results show that Byods offers both improved algorithmic scalability (reduced time and/or space complexity) and runtimes competitive with state-of-the-art parallelizing Datalog solvers.

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.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Datalog with First-Class Facts cites egg: Fast and extensible equality saturation
  • Datalog with First-Class Facts cites A systematic approach to deriving incremental type checkers
  • Flan: An Expressive and Efficient Datalog Compiler for Program Analysis cites Better Together: Unifying Datalog and Equality Saturation
  • Flan: An Expressive and Efficient Datalog Compiler for Program Analysis cites Formulog: Datalog for SMT-based static analysis
  • Better Together: Unifying Datalog and Equality Saturation cites Formulog: Datalog for SMT-based static analysis
  • Better Together: Unifying Datalog and Equality Saturation cites egg: Fast and extensible equality saturation
  • Incremental whole-program analysis in Datalog with lattices cites A systematic approach to deriving incremental type checkers
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. Flan: An Expressive and Efficient Datalog Compiler for Program AnalysisSupun Abeysinghe, Anxhelo Xhebraj, Tiark RompfPOPL 2024 · 9 citations
  2. Towards Systematic Index DynamizationDouglas B. Rumbaugh, Dong Xie, Zhuoyue ZhaoVLDB 2024 · 6 citations
  3. Relational Abstractions Based on Labeled Union-FindDorian Lesbre, Matthieu Lemerre, Hichem Rami Ait El Hara, François BobotPLDI 2025 · 3 citations
  4. Datalog with First-Class FactsThomas Gilray, Arash Sahebolamri, Yihao Sun, Sowmith Kunapaneni et al.VLDB 2025 · 3 citations
  5. Optimizing Datalog for the GPUYihao Sun, Ahmedur Rahman Shovon, Thomas Gilray, Sidharth Kumar et al.ASPLOS 2025 · 3 citations

Builds on7

  1. egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt et al.POPL 2021 · 170 citations
  2. Incremental whole-program analysis in Datalog with latticesTamás Szabó, Sebastian Erdweg, Gábor BergmannPLDI 2021 · 39 citations
  3. Better Together: Unifying Datalog and Equality SaturationYihong Zhang, Yisu Remy Wang, Oliver Flatt, David Cao et al.PLDI 2023 · 38 citations
  4. Formulog: Datalog for SMT-based static analysisAaron Bembenek, Michael Greenberg, Stephen ChongOOPSLA 2020 · 26 citations
  5. A systematic approach to deriving incremental type checkersAndré Pacak, Sebastian Erdweg, Tamás SzabóOOPSLA 2020 · 16 citations

Related papers

  1. Universal Scalability in Declarative Program Analysis (with Choice-Based Combination Pruning)Anastasios Antoniadis, Ilias Tsatiris, Neville Grech, Yannis SmaragdakisOOPSLA 2025
  2. Flix: A Design for Language-Integrated DatalogMagnus Madsen, Ondrej LhotákOOPSLA 2025
  3. Dependency-Aware Metamorphic Testing of Datalog EnginesMuhammad Numair Mansur, Valentin Wüstholz, Maria ChristakisISSTA 2023 · 10 citations
  4. Program Repair Guided by Datalog-Defined Static AnalysisYu Liu, Sergey Mechtaev, Pavle Subotic, Abhik RoychoudhuryFSE 2023 · 14 citations
  5. Fixpoints for the masses: programming with first-class Datalog constraintsMagnus Madsen, Ondrej LhotákOOPSLA 2020 · 22 citations
Dusk over the sea between two cliffs drawn in fine vertical lines