Conference Schedule - PGCon 2020

Hacking the Query Planner, Again

Date: 2020-05-27
Time: 11:00 - 11:45
Room: Stream 1
Level: Intermediate

This talk will focus on how the planner works from a developer’s view and elaborate on the process of converting a query tree to a plan tree in details.

We can divide the planning process into 4 phases: preprocessing, scan/join planning, post scan/join planning and postprocessing. In this talk, I will explain what stuff is performed in each phase and what is the motivation to perform that. Topics will include: transforming ANY/EXISTS SubLinks into joins, flattening sub-selects, preprocessing expressions, reducing outer joins to inner joins, distributing quals to rels, collecting join ordering restrictions, removing useless joins, join searching process, upper planner path-ification, cost estimation, etc.

Tom Lane's 2011 talk "Hacking the Query Planner” talked about the overview of query planner. In this talk, I will cover the internals of query planner with more details and in a way more close to planner codes. I hope this will be helpful in understanding the internals of PostgreSQL's planner and in hacking the planner codes to improve it.



The following slides have been made available for this session:


Richard Guo