arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.09944cs.DB
收藏

PLOP:基于成本的语义运算符在混合查询计划中的放置

PLOP: Cost-Based Placement of Semantic Operators in Hybrid Query Plans

UC Berkeley(加州大学伯克利分校);University of Wisconsin-Madison(威斯康星大学麦迪逊分校)

Qiuyang Mang, Yufan Xiang, Hangrui Zhou, Runyuan He, Jiaxiang Yu, Hanchen Li, Aditya Parameswaran, Alvin Cheung

AI总结:

PLOP通过等价保留的重写将混合语义-关系查询规划简化为语义过滤器放置,通过动态规划模型平衡LLM和关系成本,实现1.5倍速度提升和4.29倍成本降低。

摘要:

近期数据库系统引入了利用大型语言模型(LLMs)的语义运算符,用于通过自然语言谓词过滤、连接和投影结构化数据。在实践中,这些运算符与传统关系运算符结合,产生混合查询计划,其执行成本取决于昂贵的LLM调用和传统数据库处理。关键优化问题是如何将每个语义运算符放置在计划中的关系运算符位置:放置较早可减少后续运算符处理的数据量,但需更多LLM调用;放置较晚可通过去重减少LLM调用,但迫使关系运算符处理更大的中间数据。现有系统要么忽略此放置问题,要么应用简单启发式方法而不考虑完整成本权衡。我们提出PLOP,一种混合语义-关系查询的计划级优化器。PLOP通过两种等价保留的重写将混合查询规划简化为语义过滤器放置。我们证明在函数缓存下,将所有语义过滤器推迟到最晚位置可最小化LLM调用,但显示这可能导致复杂多表查询的关系处理成本主导。为平衡LLM成本与关系成本,PLOP使用基于动态规划的成本模型,找到最小化其加权和的放置。在44个语义SQL查询跨五个模式和两个基准上,PLOP实现高达1.5倍速度提升和4.29倍成本降低,同时保持高质量输出:平均F1值为0.85,优于未优化基线和人类标注的SemBench地面真相。总体而言,PLOP在六个公开可用系统中实现了显著的成本降低,同时保持最高准确性。

英文摘要:

Recent database systems have introduced semantic operators that leverage large language models (LLMs) to filter, join, and project over structured data using natural language predicates. In practice, these operators are combined with traditional relational operators, e.g., equi-joins, producing hybrid query plans whose execution cost depends on both expensive LLM calls and conventional database processing. A key optimization question is where to place each semantic operator relative to the relational operators in the plan: placing them earlier reduces the data that subsequent operators process, but requires more LLM calls; placing them later reduces LLM calls through deduplication, but forces relational operators to process larger intermediate data. Existing systems either ignore this placement question or apply simple heuristics without considering the full cost trade-off. We present PLOP, a plan-level optimizer for hybrid semantic-relational queries. PLOP reduces hybrid query planning to semantic filter placement via two equivalence-preserving rewrites. We prove that deferring all semantic filters to the latest possible position minimizes LLM invocations under function caching, but show that this can cause relational processing costs to dominate on complex multi-table queries. To balance LLM cost against relational cost, PLOP uses a dynamic-programming-based cost model that finds the placement minimizing their weighted sum. On 44 semantic SQL queries across five schemas and two benchmarks, PLOP achieves up to 1.5$\times$ speedup and 4.29$\times$ cost reduction while maintaining high output quality: an average F1 of 0.85 against the unoptimized baseline and 0.84 against human-annotated ground truth on SemBench. Overall, PLOP achieves a significant cost reduction while preserving the highest accuracy among six publicly available systems.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑