Adaptive Execution of Compiled Queries

Compiling queries to machine code is a very efficient way for executing queries. One often overlooked problem with compilation is the time it takes to generate machine code. Even with fast compilation frameworks like LLVM, generating machine code for complex queries often takes hundreds of milliseconds. Such durations can be a major disadvantage for workloads that execute many complex, but quick queries. To solve this problem, we propose an adaptive execution framework, which dynamically switches from interpretation to compilation. We also propose a fast bytecode interpreter for LLVM, which can execute queries without costly translation to machine code and dramatically reduces the query latency. Adaptive execution is fine-grained, and can execute code paths of the same query using different execution modes. Our evaluation shows that this approach achieves optimal performance in a wide variety of settings—low latency for small data sets and maximum throughput for large data sizes.

[1]  Jignesh M. Patel,et al.  Design and Evaluation of Storage Organizations for Read-Optimized Main Memory Databases , 2013, Proc. VLDB Endow..

[2]  Vivek Sarkar,et al.  Linear scan register allocation , 1999, TOPL.

[3]  Per-Åke Larson,et al.  SQL server column store indexes , 2011, SIGMOD '11.

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

[5]  Sam Lightstone,et al.  DB2 with BLU Acceleration: So Much More than Just a Column Store , 2013, Proc. VLDB Endow..

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

[7]  Lin Ma,et al.  Self-Driving Database Management Systems , 2017, CIDR.

[8]  Nong Li,et al.  Runtime Code Generation in Cloudera Impala , 2014, IEEE Data Eng. Bull..

[9]  Thomas Heinis,et al.  Just-In-Time Data Virtualization: Lightweight Data Management with ViDa , 2015, CIDR.

[10]  Fernando Magno Quintão Pereira,et al.  The Design and Implementation of a SSA-based Register Allocator , 2007 .

[11]  Viktor Leis,et al.  Query optimization through the looking glass, and what we found running the Join Order Benchmark , 2017, The VLDB Journal.

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

[13]  Jignesh M. Patel,et al.  Quickstep: a data platform based on the scaling-up approach , 2018, VLDB 2018.

[14]  Jignesh M. Patel,et al.  Quickstep: A Data Platform Based on the Scaling-Up Approach , 2018, Proc. VLDB Endow..

[15]  Todd C. Mowry,et al.  Relaxed Operator Fusion for In-Memory Databases: Making Compilation, Vectorization, and Prefetching Work Together At Last , 2017, Proc. VLDB Endow..

[16]  Robert E. Tarjan,et al.  Finding Dominators in Practice , 2004, ESA.

[17]  Carsten Binnig,et al.  An Architecture for Compiling UDF-centric Workflows , 2015, Proc. VLDB Endow..

[18]  Viktor Leis,et al.  How Good Are Query Optimizers, Really? , 2015, Proc. VLDB Endow..

[19]  Milos Nikolic,et al.  DBToaster: Higher-order Delta Processing for Dynamic, Frequently Fresh Views , 2012, Proc. VLDB Endow..

[20]  Torsten. Grust,et al.  Accelerating XPath location steps , 2002, SIGMOD '02.

[21]  Craig Freedman,et al.  Compilation in the Microsoft SQL Server Hekaton Engine , 2014, IEEE Data Eng. Bull..

[22]  Tim Kraska,et al.  Tupleware: "Big" Data, Big Analytics, Small Clusters , 2015, CIDR.

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

[24]  Richard T. Snodgrass,et al.  Micro-Specialization in DBMSes , 2012, 2012 IEEE 28th International Conference on Data Engineering.

[25]  Robert E. Tarjan,et al.  Finding dominators via disjoint set union , 2013, J. Discrete Algorithms.

[26]  Stratis Viglas,et al.  Generating code for holistic query evaluation , 2010, 2010 IEEE 26th International Conference on Data Engineering (ICDE 2010).

[27]  Viktor Leis,et al.  Morsel-driven parallelism: a NUMA-aware query evaluation framework for the many-core age , 2014, SIGMOD Conference.

[28]  Samuel Madden,et al.  Voodoo - A Vector Algebra for Portable Database Performance on Modern Hardware , 2016, Proc. VLDB Endow..

[29]  Viktor Leis,et al.  Compiling Database Queries into Machine Code , 2014, IEEE Data Eng. Bull..

[30]  Richard T. Snodgrass,et al.  Micro-specialization: dynamic code specialization of database management systems , 2012, CGO '12.