22-25 April 2026

Building a Query Optimizer from Scratch Part 2

Proposed session for SQLBits 2026

TL; DR

Build a query optimizer from scratch in 2 hours. Learn how databases execute queries efficiently by implementing parsing, plan generation, and cost-based optimization. Understand the principles behind real database optimizers.

Session Details

Ever wondered how databases execute your queries efficiently? In this session, we'll build a query optimizer from the ground up in just 2 hours. You'll learn the core concepts behind query optimization, from parsing SQL and building execution plans to applying cost-based transformations by implementing them ourselves. We'll start with a simple SQL query, walk through plan generation, and progressively add optimization techniques. By the end, you'll understand the fundamental principles that powers real database optimizers.

3 things you'll get out of this session

Provide a detailed insights, how query optimizers works internally by building a simple one from scratch