Grouping and aggregations on Vitess
Jun 24, 2022Andres Taylor

Summary
This post details how Vitess's query planner was enhanced to push down grouping and aggregation operations under joins, inspired by the paper 'Orthogonal Optimization of Subqueries and Aggregation'. It explains the local and global aggregation strategy, the evalengine's role in mimicking MySQL expressions at the VTGate level, and provides a detailed example of planning and executing a query involving a join between sharded `order` and `order_line` tables. The contribution enables more complex queries to be efficiently processed across shards by optimizing the order of operations.