PGCon2016 - 1.1.35

PGCon 2016
The PostgreSQL Conference

Ozgun Erdogan
Day Talks - Day 2 - 2016-05-20
Room DMS 1110
Start time 16:00
Duration 00:45
ID 944
Event type Lecture
Track Scaling Out
Language used for presentation English

Lessons in Building a Distributed Query Planner

Why Some SQL Queries are Hard to Scale

Citus is a distributed database that scales out Postgres. By using the extension APIs, Citus distributes your tables across a cluster of machines and parallelizes SQL queries. This talk describes Citus' distributed query planner by focusing on our experience in distributed systems.

We first show that the primary challenge for any distributed planner is a theoretical understanding of which computations are easy to scale. We provide three example SQL queries that demonstrate these challenges: (a) simpler aggregate functions with groupings, (b) large table joins, and (c) complex subselects. We then explain why some queries are harder to scale than others.

Next, we map these two queries into relational algebra (logical plan). We show that a simple abstraction, one that separates logical and physical planning, can minimize network I/O and parallelize all SQL queries in a small amount of code. We conclude by comparing query planning methods across different distributed databases.