Compilation of Cursor Loops by Realizing Aggify: Project Home Page 🏠

Published on
2 mins read
––– views

Group Information

Haoyu Zhang: haoyuzha

Yuchen Liu: yuchenl6

URLs for Project

Project Description

We would like to realize the techniques discussed in Paper: Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates in DuckDB. Aggify is an optimization pass that can rewrite cursor loops in Procedural User Defined Functions as custom aggregation functions. Then we can apply techniques like UDF inlining [2, 3] or UDF compilation [4]. We would like to target PL/PgSQL UDFs and the database platform DuckDB in this project. We choose PL/pgSQL because it is static and the language syntax is relatively conservative, making the compilation process easier. We choose DuckDB because we already have abundant experience with it, and the open-source community of it has been extremely helpful.

This technique requires constructing CFG for the entire procedure code, doing some data flow analysis including reaching definition analysis and live variable analysis as well as generating custom aggregation function in C++ and rewriting the original UDF that contains cursor loop to call the aggregation function.