1. Overview
In this article we will use GDB debugger to trace the internals of Postgres and observe how an input query passes through several levels of transformation (Parser -> Analyzer -> Rewriter -> Planner -> Executor) and eventually produces an output.
This article is based on PG12 running on Ubuntu 18.04, and we will use a simple SELECT
query with ORDER BY
, GROUP BY
, and LIMIT
keywords to go through the entire query processing tracing.