To Iterate Is Human, to Recurse Is Divine—Mapping Iterative Python to Recursive SQL
Datenbanksysteme für Business, Technologie und Web (BTW 2023), Student Program, Dresden, Germany, March 2023. Best Student Contribution
Writing complex algorithms and iterative computations in SQL is difficult at best, commonly leading to code that intermingles looping control flow with database access. This yields programs with control flow that rapidly hops in and out of the database, with each roundtrip incurring significant overhead. We present the ByePy compiler, which can compile entire Python functions directly to plain recursive SQL:1999 queries. By doing so, the compilation eliminates all but a single roundtrip, leading to runtime speedups of up to an order of magnitude.