Efficient generation of machine code for query compilers

Query compilation can make query execution extremely efficient, but it introduces additional compilation time. The compilation time causes a relatively high overhead especially for short-running and high-complexity queries. We propose Flounder IR as a lightweight intermediate representation for query compilation to reduce compilation times. Flounder IR is close to machine assembly and adds just that set of features that is necessary for efficient query compilation: virtual registers and function calls ease the construction of the compiler front-end; database-specific extensions enable efficient pipelining in query plans; more elaborate IR features are intentionally left out to maximize compilation speed. In this paper, we present the Flounder IR language and motivate its design; we show how the language makes query compilation intuitive and efficient; and we demonstrate with benchmarks how our Flounder library can significantly reduce query compilation times.

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

[2]  John Cocke,et al.  A methodology for the real world , 1981 .

[3]  Jens Teubner,et al.  Pipelined Query Processing in Coprocessor Environments , 2018, SIGMOD Conference.

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

[5]  Brian N. Bershad,et al.  Fast, effective dynamic compilation , 1996, PLDI '96.

[6]  Gerhard Fettweis,et al.  HASHI: An Application Specific Instruction Set Extension for Hashing , 2014, ADMS@VLDB.

[7]  Marcin Zukowski,et al.  MonetDB/X100: Hyper-Pipelining Query Execution , 2005, CIDR.

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

[9]  J EggersSusan,et al.  Fast, effective dynamic compilation , 1996 .

[10]  Tilmann Rabl,et al.  Generating custom code for efficient query execution on heterogeneous processors , 2017, The VLDB Journal.

[11]  Weihaw Chuang,et al.  The Intel IA-64 Compiler Code Generator , 2000, IEEE Micro.

[12]  Jens Teubner,et al.  Data-parallel query processing on non-uniform data , 2020, Proc. VLDB Endow..

[13]  Viktor Leis,et al.  Adaptive Execution of Compiled Queries , 2018, 2018 IEEE 34th International Conference on Data Engineering (ICDE).

[14]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

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

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

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

[18]  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..

[19]  Evangelos Vlachos,et al.  A Many-core Architecture for In-Memory Data Processing , 2017, 2017 50th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO).

[20]  John Cocke,et al.  Register Allocation Via Coloring , 1981, Comput. Lang..