Iterative Query Processing based on Unified Optimization Techniques

Hybrid transactional and analytical processing (HTAP) systems like SAP HANA make it much simpler to manage both operational load and analytical queries without ETL, separate data warehouses, et al. To represent both transactional and analytical business logic in a single database system, stored procedures are often used to express analytical queries using control flow logic and DMLs. Optimizing these complex procedures requires a fair knowledge of imperative programming languages as well as the declarative query language. Therefore, unified optimization techniques considering both program and query optimization techniques are essential for achieving optimal query performance. In this paper, we propose a novel unified optimization technique for efficient iterative query processing. We present a notion of query motion that allows the movement of SQL queries in and out of a loop. Additionally, we exploit a new cost model that measures the quality of the execution plan with consideration for queries and loop iterations. We describe our experimental evaluation that demonstrates the benefit of our technique using both a standard decision support benchmark and real-world workloads. An extensive evaluation shows that our unified optimization technique enumerates plans that achieve performance improvements of up to an order of magnitude faster than plans generated by the existing loop-invariant code motion technique.

[1]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[2]  Sabine Glesner,et al.  Static Prediction of Loop Iteration Counts Using Machine Learning to Enable Hot Spot Optimizations , 2013, 2013 39th Euromicro Conference on Software Engineering and Advanced Applications.

[3]  S. Sudarshan,et al.  Program analysis and transformation for holistic optimization of database applications , 2012, SOAP '12.

[4]  Kwanghyun Park,et al.  Froid: Optimization of Imperative Programs in a Relational Database , 2017, Proc. VLDB Endow..

[5]  Soichiro Hidaka,et al.  Optimization for iterative queries on MapReduce , 2013, Proc. VLDB Endow..

[6]  Norman May,et al.  SQLScript: Efficiently Analyzing Big Enterprise Data in SAP HANA , 2013, BTW.

[7]  Matei Zaharia,et al.  A Common Runtime for High Performance Data Analysis , 2017, CIDR.

[8]  David J. DeWitt,et al.  A transformation-based approach to optimizing loops in database programming languages , 1992, SIGMOD '92.

[9]  S. Sudarshan,et al.  Rewriting procedures for batched bindings , 2008, Proc. VLDB Endow..

[10]  Zohra Bellahsene,et al.  A survey of view selection methods , 2012, SGMD.

[11]  S. Sudarshan,et al.  Extracting Equivalent SQL from Imperative Code in Database Applications , 2016, SIGMOD Conference.

[12]  Michael Stonebraker,et al.  S-Store: Streaming Meets Transaction Processing , 2015, Proc. VLDB Endow..

[13]  Christoph Koch,et al.  Building Efficient Query Engines in a High-Level Language , 2014, TODS.

[14]  Saman P. Amarasinghe,et al.  Weld : A Common Runtime for High Performance Data Analytics , 2016 .

[15]  George C. Caragea,et al.  Optimization of Common Table Expressions in MPP Database Systems , 2015, Proc. VLDB Endow..

[16]  David Kaeli,et al.  Runtime predictability of loops , 2001 .

[17]  Alvin Cheung,et al.  Sloth: being lazy is a virtue (when issuing database queries) , 2014, SIGMOD Conference.

[18]  Marc Hoppe,et al.  Materials Planning with SAP , 2009 .

[19]  Shirish Tatikonda,et al.  SystemML's Optimizer: Plan Generation for Large-Scale Machine Learning Programs , 2014, IEEE Data Eng. Bull..

[20]  Thomas Neumann,et al.  Efficiently Compiling Efficient Query Plans for Modern Hardware , 2011, Proc. VLDB Endow..

[21]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[22]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[23]  César A. Galindo-Legaria,et al.  Orthogonal optimization of subqueries and aggregation , 2001, SIGMOD '01.

[24]  Amir Shaikhha,et al.  How to Architect a Query Compiler , 2016, SIGMOD Conference.

[25]  Alvin Cheung,et al.  Inferring SQL Queries Using Program Synthesis , 2012, ArXiv.

[26]  Jiawei Han,et al.  gSpan: graph-based substructure pattern mining , 2002, 2002 IEEE International Conference on Data Mining, 2002. Proceedings..

[27]  Craig Freedman,et al.  Hekaton: SQL server's memory-optimized OLTP engine , 2013, SIGMOD '13.

[28]  David R. Kaeli,et al.  Path-based Hardware Loop Prediction , 2022 .

[29]  Keith D. Cooper,et al.  Engineering a Compiler , 2003 .