Aggify series: Home (this page) ยท Proposal ยท Milestone ยท Final report
Group Information
Haoyu Zhang: haoyuzha
Yuchen Liu: yuchenl6
URLs for Project
Project Description
We want to implement the techniques from the paper Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates in DuckDB. Aggify is an optimization pass that rewrites the cursor loops in procedural user-defined functions as custom aggregate functions, after which techniques like UDF inlining [2, 3] or UDF compilation [4] can be applied. We target PL/pgSQL UDFs and DuckDB. PL/pgSQL is static and syntactically conservative, which makes compilation easier; DuckDB is a system we already know well, and its open-source community has been very helpful.
The technique requires building a CFG for the whole procedure, running dataflow analyses (reaching definitions, live variables), generating the custom aggregate in C++, and rewriting the original UDF to call it.