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

嵌套式编译器和程序的优化与评价

Optimization and Evaluation of Nested Queries and Procedures

Ravindra Guravannavar

摘要:

许多数据库应用程序执行复杂的数据检索和更新任务。嵌套查询和调用用户定义函数的查询(使用过程结构和SQL结构的混合编写)通常用于此类应用程序中。这种查询的直接评估涉及重复执行参数化子查询或包含查询和过程代码的块。在优化嵌套查询以及具有连接、聚合和集合操作的查询时出现的一个重要问题是从可能的排序顺序的阶乘数量中找到最优排序顺序的问题。我们表明,即使是一个特殊的情况下,这个问题是NP难的,并提出实用的算法,是有效的,易于纳入现有的查询优化。我们还考虑了在复杂的过程块(如用户定义的函数和存储过程)内迭代执行查询和更新。参数批处理是提高性能的重要手段,因为它支持面向集合的处理。参数重写的关键挑战在于重写给定的过程/函数来处理一批参数值。我们提出了一个解决方案,基于程序分析和重写规则,自动生成批处理形式的程序,并取代迭代数据库调用内的命令循环与一个单一的调用批处理形式。我们提出的技术的实验结果,结果显示显着的性能增益。

英文摘要:

Many database applications perform complex data retrieval and update tasks. Nested queries, and queries that invoke user-defined functions, which are written using a mix of procedural and SQL constructs, are often used in such applications. A straight-forward evaluation of such queries involves repeated execution of parameterized sub-queries or blocks containing queries and procedural code. An important problem that arises while optimizing nested queries as well as queries with joins, aggregates and set operations is the problem of finding an optimal sort order from a factorial number of possible sort orders. We show that even a special case of this problem is NP-Hard, and present practical heuristics that are effective and easy to incorporate in existing query optimizers. We also consider iterative execution of queries and updates inside complex procedural blocks such as user-defined functions and stored procedures. Parameter batching is an important means of improving performance as it enables set-orientated processing. The key challenge to parameter batching lies in rewriting a given procedure/function to process a batch of parameter values. We propose a solution, based on program analysis and rewrite rules, to automate the generation of batched forms of procedures and replace iterative database calls within imperative loops with a single call to the batched form. We present experimental results for the proposed techniques, and the results show significant gains in performance.

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

↑