Result
Appears in EXPLAIN asResult
Emits computed rows, or gates execution on a one-time condition.
What it is
A Result node returns rows from a constant expression (e.g. SELECT 1), projects expressions, or applies a one-time filter that can skip its child entirely when a condition is provably false.
When the planner picks it
For constant SELECTs, for INSERT ... VALUES, and as a wrapper that adds a one-time gating condition above another node.
Is it good or bad?
Negligible cost and entirely normal. Not something you tune.
In depth
A few quiet jobs
Result is the executor's general-purpose "produce something" node. You'll
see it for a handful of small, distinct jobs:
- A constant SELECT:
SELECT 1orSELECT now()becomes a Result that emits one row with the expression evaluated. - A target-list projector in places where the planner needs to compute expressions after another node — sometimes above a join, sometimes above a scan when the column list isn't the natural one.
- A one-time gate: a Result wraps a child and applies a condition that's
known at plan start (constant
false, orWHERE col IS NULLwhen stats say the column isNOT NULL). If the condition is provably false, the child is never executed.
You'll also see Result in some special-case plans — INSERT … VALUES, a
SELECT INTO of a constant, RETURNING expressions, and so on.
What you can ignore
Result almost never has a meaningful cost on its own; the executor needs the node, but the work is in its child (if any). It's not something to tune.
The exception is when a Result wraps a non-trivial expression that's computed per output row — a very expensive function applied in the SELECT list, say. In that case the cost is in the expression, not the node label.