Database Systems

Bringing Flummi to WITH MUTUALLY RECURSIVE on Materialize DB

Flummi is a compiler that translates programs written in the simple, imperative language PL\Flummi into the Structured Query Language (SQL). It converts each block of a program’s Control Flow Graph (CFG) into a Common Table Expression (CTE) and implements loops in the control flow using a recursive CTE. In this thesis, we adjust Flummi to compile PL\Flummi programs into mutually recursive CTEs for evaluation by Materialize DB, a streaming SQL database system with its own specialized version of recursive CTEs. We then examine the performance impact of this change in compilation method on PL\Flummi programs, discovering that Materialize DB performs better on compiled queries that leverage its mutual recursion capabilities than on those using only standard SQL recursion. A key feature of Materialize DB is its support for incremental updates, allowing for recomputing only parts of the query results when underlying data changes, rather than reprocessing the entire data. We explore the performance of PL\Flummi programs with incremental updates and our experiments show that the queries perform well in these dynamic scenarios. Despite the generally slower performance of Materialize DB compared to other Database Management Systems (DBMSs) like PostgreSQL, we conclude that PL\Flummi programs can benefit from mutual recursion, and that in combination with incrementalization, Materialize DB is a viable compilation target for Flummi in real-world applications.

Contact

Tim Fischer