PGCon2019 - 3.4

PGCon 2019
The PostgreSQL Conference

Melanie Plageman
Day Talks - Day 1 - 2019-05-30
Room DMS 1160
Start time 14:00
Duration 00:45
ID 1379
Event type Lecture
Track Hacking
Language used for presentation English

Intro to Postgres Planner Hacking

This talk will cover the process of debugging a bad plan starting from the explain output through hacking in a fix and recompiling the database. Topics covered will include: characteristics of a plan and how these map to components in Postgres code, strategies for producing a minimal repro, simple heuristics for developing a reference plan, using the debugger along with several GUCs to examine the plan tree throughout planning, and, finally, adding in your own code.

The intro to query optimization topics covers the basic stages of planning and how those are represented in the form of a query tree and, ultimately, plan tree in Postgres' query optimizer.

The case study uses a simple example of a "bad" plan to show how to determine where to add code to modify the behavior of planner.

The first few and last slide will be used to discuss how people learned to hack on Postgres planner and what most helped them.