A Deep Embedding of Queries into Ruby

Torsten GrustManuel Mayr

Proceedings of the 28th IEEE International Conference on Data Engineering (ICDE 2012), Washington, DC, USA, April 2012.

We demonstrate Switch, a deep embedding of relational queries into Ruby and Ruby on Rails. With Switch, there is no syntactic or stylistic difference between Ruby programs that operate over in-memory array objects or database-resident tables, even if these programs rely on array order or nesting. Switch’s built-in compiler and SQL code generator guarantee to emit few queries, addressing long-standing performance problems that trace back to Rail’s Active Record database binding. “Looks likes Ruby, but performs like handcrafted SQL,” is the ideal that drives the research and development effort behind Switch.