Compiling PL/SQL Away
Christian Duta, Denis Hirn, Torsten Grust

TL;DR
This paper introduces a method to compile PL/SQL functions into SQL queries, significantly improving performance by eliminating interpretation overhead and enabling efficient evaluation within the database engine.
Contribution
It presents a novel compilation technique that transforms arbitrary PL/SQL functions into SQL subqueries, including recursive control flow, for faster execution.
Findings
Significant runtime improvements across various RDBMSs
Effective compilation of complex control flow including recursion
Challenging traditional developer assumptions about PL/SQL performance
Abstract
"PL/SQL functions are slow," is common developer wisdom that derives from the tension between set-oriented SQL evaluation and statement-by-statement PL/SQL interpretation. We pursue the radical approach of compiling PL/SQL away, turning interpreted functions into regular subqueries that can then be efficiently evaluated together with their embracing SQL query, avoiding any PL/SQL to SQL context switches. Input PL/SQL functions may exhibit arbitrary control flow. Iteration, in particular, is compiled into SQL-level recursion. RDBMSs across the board reward this compilation effort with significant run time savings that render established developer lore questionable.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Parallel Computing and Optimization Techniques · Advanced Database Systems and Queries
