PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
April 25, 2026ACM SIGMOD Record0 citations

Partial UDF Inlining

View Full Paper
SASamuel ArchCarnegie Mellon UniversityYLYuchen LiuCarnegie Mellon UniversityTMTodd C. MowryCarnegie Mellon University

Key Points

  • The aim is to optimize query performance by selectively inlining pieces of user-defined functions (UDFs).
  • Analyzed UDFs to identify components for inlining.
  • Implemented UDF outlining to hide certain UDF pieces during optimization.
  • Compared performance metrics of PRISM implementation against conventional inlining.
  • Average speedup of 1.29× for DuckDB and 298.73× for SQL Server with UDF outlining.
  • Enhanced query plans through effective unnesting and improved data skipping.
  • Avoided unnecessary joins, leading to faster overall query execution.

Abstract

Although user-defined functions (UDFs) are a popular way to augment SQL's declarative approach with procedural code, the mismatch between programming paradigms creates a fundamental optimization challenge. UDF inlining automatically removes all UDF calls by replacing them with equivalent SQL subqueries. Although inlining leaves queries entirely in SQL (resulting in large performance gains), we observe that inlining the entire UDF often leads to suboptimal performance. A better approach is to analyze the UDF, deconstruct it into smaller pieces, and inline only the pieces that help query optimization. To achieve this, we propose UDF outlining, a technique to intentionally hide pieces of a UDF from the optimizer, resulting in simpler UDFs and significantly faster query plans. Our implementation (PRISM) demonstrates that UDF outlining improves performance over conventional inlining (on average 1.29× speedup for DuckDB and 298.73× for SQL Server) through a combination of more effective unnesting, improved data skipping, and by avoiding unnecessary joins.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Arch et al. (2026) studied this question.

synapsesocial.com/papers/69ec5aa788ba6daa22dac261https://doi.org/10.1145/3810900.3810914
Ask AI
Helpful
Bookmark
Share
View Full Paper