How to Architect a Query Compiler

Amir Shaikhha, Yannis Klonatos, Lionel Parreaux, Lewis Brown, Mohammad Dashti, Christoph Koch
2016 Proceedings of the 2016 International Conference on Management of Data - SIGMOD '16  
This paper studies architecting query compilers. The state of the art in query compiler construction is lagging behind that in the compilers field. We attempt to remedy this by exploring the key causes of technical challenges in need of well founded solutions, and by gathering the most relevant ideas and approaches from the PL and compilers communities for easy digestion by database researchers. All query compilers known to us are more or less monolithic template expanders that do the bulk of
more » ... e compilation task in one large leap. Such systems are hard to build and maintain. We propose to use a stack of multiple DSLs on different levels of abstraction with lowering in multiple steps to make query compilers easier to build and extend, ultimately allowing us to create more convincing and sustainable compiler-based data management systems. We attempt to derive our advice for creating such DSL stacks from widely acceptable principles. We have also re-created a well-known query compiler following these ideas and report on this effort. SELECT COUNT( * ) FROM R, S WHERE R.name == "R1" AND R.sid == S.rid (a) The example query in SQL. AggOp( HashJoinOp( SelectOp(R, "name", EQ,"R1"), S, "sid", "rid"), COUNT) (b) The example query in QPlan. R.filter(r => r.name == "R1" ).hashJoin(S)(r => r.sid)(s => s.rid) .count (c) The example query in QMonad. 1 val hm = new MultiMap[Int, R] 2 3 for(r <-R) { 4 if(r.name == "R1") { 5 6 7 hm.addBinding(r.sid, r) 8 9 10
doi:10.1145/2882903.2915244 dblp:conf/sigmod/ShaikhhaKPBD016 fatcat:tlwazhetpna4pmmel7iscxmqfm