Lune

VLDB2025顶会

The Key to Effective UDF Optimization: Before Inlining, First Perform Outlining

Samuel Arch, Yuchen Liu, Todd C. Mowry, Jignesh M. Patel, Andrew Pavlo

摘要

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 sub-optimal 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.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Procedural Extensions of SQL: Understanding their usage in the wild 引用了 Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates
  • Babelfish: Efficient Execution of Polyglot Queries 引用了 Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates
  • Scalable GPU Acceleration of Scalar Functions in Analytical Databases: Compilation, Benchmarking, and Optimization 引用了 The UDFBench Benchmark for General-purpose UDF Queries
  • Scalable GPU Acceleration of Scalar Functions in Analytical Databases: Compilation, Benchmarking, and Optimization 引用了 Designing an Open Framework for Query Optimization and Compilation
  • The UDFBench Benchmark for General-purpose UDF Queries 引用了 Procedural Extensions of SQL: Understanding their usage in the wild
  • The UDFBench Benchmark for General-purpose UDF Queries 引用了 Babelfish: Efficient Execution of Polyglot Queries
  • The UDFBench Benchmark for General-purpose UDF Queries 引用了 Tuplex: Data Science in Python at Native Code Speed
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. Scalable GPU Acceleration of Scalar Functions in Analytical Databases: Compilation, Benchmarking, and OptimizationKaushik Rajan, Sampath Rajendra, Momin Al-Ghosien, Nicolas Bruno 等VLDB 2026
  2. The UDFBench Benchmark for General-purpose UDF QueriesYannis Foufoulas, Theoni Palaiologou, Alkis SimitsisVLDB 2025

它引用的 Paper8

  1. Designing an Open Framework for Query Optimization and CompilationMichael Jungmair, André Kohn, Jana GicevaVLDB 2022 · 45 次引用
  2. Procedural Extensions of SQL: Understanding their usage in the wildSurabhi Gupta, Karthik RamachandraVLDB 2021 · 34 次引用
  3. Babelfish: Efficient Execution of Polyglot QueriesPhilipp Marian Grulich, Steffen Zeuch, Volker MarklVLDB 2022 · 32 次引用
  4. Tuplex: Data Science in Python at Native Code SpeedLeonhard F. Spiegelberg, Rahul Yesantharao, Malte Schwarzkopf, Tim KraskaSIGMOD 2021 · 32 次引用
  5. Aggify: Lifting the Curse of Cursor Loops using Custom AggregatesSurabhi Gupta, Sanket Purandare, Karthik RamachandraSIGMOD 2020 · 22 次引用

相关 Paper

  1. QURE: AI-Assisted and Automatically Verified UDF InliningTarique Siddiqui, Arnd Christian König, Jiashen Cao, Cong Yan 等SIGMOD 2025 · 2 次引用
  2. One WITH RECURSIVE is Worth Many GOTOsDenis Hirn, Torsten GrustSIGMOD 2021 · 19 次引用
  3. UDF to SQL translation through compositional lazy inductive synthesisGuoqiang Zhang, Yuanchao Xu, Xipeng Shen, Isil DilligOOPSLA 2021 · 14 次引用
  4. A Framework For Inferring Properties of User-Defined FunctionsXinyu Liu, Joy Arulraj, Alessandro OrsoICSE 2024
  5. Containerized Execution of UDFs: An Experimental EvaluationKarla Saur, Tara Mirmira, Konstantinos Karanasos, Jesús Camacho-RodríguezVLDB 2022 · 14 次引用
黄昏的海面,两侧是细线勾勒的悬崖