Query processing

Portal

Also called: execution portal, cursor

A portal is the container that holds the state of a query while it runs: its plan, its position in the result, and the memory it uses. When you open a cursor, you are creating a portal you can fetch from a few rows at a time.

What this means

The container that holds a running query's state, its plan, where it currently is in the results, and the memory it's using. When you open a cursor and fetch a few rows at a time, that cursor is a portal you're pulling from.

Why it matters operationally

Portals are how PostgreSQL streams results without materializing everything at once, and how the extended protocol's "execute" step is implemented. Understanding them demystifies cursors, FETCH, and why a held cursor keeps resources alive.

Related & next

The Parse, Plan, Execute Pipeline, execution inside a portalPlan tree, what a portal executesConnection vs Session, the context a portal lives in

Mentioned from

← All glossary terms · GUC reference · Error catalog