Lune

SIGMOD2021Top-tier venue

One WITH RECURSIVE is Worth Many GOTOs

Denis Hirn, Torsten Grust

Abstract

PL/SQL integrates an imperative statement-by-statement style of programming with the plan-based evaluation of SQL queries. The disparity of both leads to friction at runtime, slowing PL/SQL execution down significantly. This work describes a compiler from PL/SQL UDFs to plain SQL queries. Post-compilation, evaluation entirely happens on the SQL side of the fence. With the friction gone, we observe execution times to improve by about a factor of 2, even for complex UDFs. The compiler builds on techniques long established by the programming language community. In particular, it uses trampolined style to compile arbitrarily nested iterative control flow in PL/SQL into SQL's recursive common table expressions.

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.

10 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

  • The Key to Effective UDF Optimization: Before Inlining, First Perform Outlining cites Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers10

  1. User-Defined Operators: Efficiently Integrating Custom Algorithms into Modern DatabasesMoritz Sichert, Thomas NeumannVLDB 2022 · 23 citations
  2. Efficient and Portable Einstein Summation in SQLMark Blacher, Julien Klaus, Christoph Staudt, Sören Laue et al.SIGMOD 2023 · 15 citations
  3. BOSS - An Architecture for Database Kernel CompositionHubert Mohr-Daurat, Xuan Sun, Holger PirkVLDB 2024 · 12 citations
  4. The Key to Effective UDF Optimization: Before Inlining, First Perform OutliningSamuel Arch, Yuchen Liu, Todd C. Mowry, Jignesh M. Patel et al.VLDB 2025 · 8 citations
  5. Optimizing Nested Recursive QueriesAmir Shaikhha, Dan Suciu, Maximilian Schleich, Hung Q. NgoSIGMOD 2024 · 5 citations

Builds on1

  1. Aggify: Lifting the Curse of Cursor Loops using Custom AggregatesSurabhi Gupta, Sanket Purandare, Karthik RamachandraSIGMOD 2020 · 22 citations

Related papers

  1. SQL Engines Excel at the Execution of Imperative ProgramsTim Fischer, Denis Hirn, Torsten GrustVLDB 2024 · 3 citations
  2. Functional-Style SQL UDFs With a Capital 'F'Christian Duta, Torsten GrustSIGMOD 2020 · 11 citations
  3. UDF to SQL translation through compositional lazy inductive synthesisGuoqiang Zhang, Yuanchao Xu, Xipeng Shen, Isil DilligOOPSLA 2021 · 14 citations
  4. QURE: AI-Assisted and Automatically Verified UDF InliningTarique Siddiqui, Arnd Christian König, Jiashen Cao, Cong Yan et al.SIGMOD 2025 · 2 citations
  5. The UDFBench Benchmark for General-purpose UDF QueriesYannis Foufoulas, Theoni Palaiologou, Alkis SimitsisVLDB 2025
Dusk over the sea between two cliffs drawn in fine vertical lines