Glossary — in plain language

Query rewriter

Also called: rewriter, rule system, QueryRewrite

In plain English

Between analysis and planning, PostgreSQL runs the rewriter. It applies rules and expands views — so a query against a view is mechanically rewritten into an equivalent query against the underlying tables before any planning happens.

Why it matters

It explains why querying a view costs the same as querying its base tables: the view is gone by the time the planner runs. The rule system is also how features like updatable views and some replication setups inject transformations, all transparently to the user.

Was this helpful?

← Browse the full glossary