Query processing

Query tree

Also called: Query node, analyzed parse tree

After parsing the syntax, PostgreSQL runs parse analysis and produces a query tree: the same statement, but with every name resolved to a real catalog object, every type checked, and shortcuts like SELECT * expanded. It is the meaning of your query, not just its shape.

What this means

Once the syntax is parsed, Postgres does a second pass that turns names into real things: every table and column is resolved to an actual catalog object, types are checked, and SELECT * is expanded into the real column list. The result is the query's meaning, not just its shape.

Why it matters operationally

This is the stage that raises errors like "column does not exist" or type mismatches. The query tree is also what the rewriter and planner consume, and the normalized form you see in tools like pg_stat_statements reflects it.

Related & next

← All glossary terms · GUC reference · Error catalog