arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2010.05807cs.SEcs.DBcs.PL
收藏

PATSQL:从示例表中高效合成SQL,并快速推断投影列

PATSQL: Efficient Synthesis of SQL Queries from Example Tables with Quick Inference of Projected Columns

Keita Takenouchi, Takashi Ishio, Joji Okada, Yuji Sakata

摘要:

SQL是最流行的数据分析工具之一,现在越来越多的没有数据库专业知识的用户使用它。一些研究已经提出了通过示例编程的方法来帮助这些非专家编写正确的SQL查询。虽然现有的方法支持各种SQL功能,如聚合和嵌套查询,但随着示例表规模的增加,它们的计算成本会显著增加。在本文中,我们提出了一个有效的算法,利用关系代数中已知的属性,从输入和输出表合成SQL查询。我们的关键见解是,投影操作程序草图可以解除以上其他运营商通过应用关系代数中的转换规则,同时保持程序的语义。这使得在投影算子中能够快速推断适当的列,这是合成中的重要组成部分,但在先前的工作中会导致组合爆炸。我们还介绍了一种新的形式的约束和自上而下的传播机制,有效的草图完成。我们在我们的工具PATSQL中实现了这个算法,并在之前的基准测试和Kaggle教程中的226个查询上进行了评估。结果,PATSQL解决了68%的基准测试,并在一秒钟内找到了89%的解决方案。我们的工具可以在https://naist-se.github.io/patsql/上找到。

英文摘要:

SQL is one of the most popular tools for data analysis, and it is now used by an increasing number of users without having expertise in databases. Several studies have proposed programming-by-example approaches to help such non-experts to write correct SQL queries. While existing methods support a variety of SQL features such as aggregation and nested query, they suffer a significant increase in computational cost as the scale of example tables increases. In this paper, we propose an efficient algorithm utilizing properties known in relational algebra to synthesize SQL queries from input and output tables. Our key insight is that a projection operator in a program sketch can be lifted above other operators by applying transformation rules in relational algebra, while preserving the semantics of the program. This enables a quick inference of appropriate columns in the projection operator, which is an essential component in synthesis but causes combinatorial explosions in prior work. We also introduce a novel form of constraints and its top-down propagation mechanism for efficient sketch completion. We implemented this algorithm in our tool PATSQL and evaluated it on 226 queries from prior benchmarks and Kaggle's tutorials. As a result, PATSQL solved 68% of the benchmarks and found 89% of the solutions within a second. Our tool is available at https://naist-se.github.io/patsql/.

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

↑