Glossary — in plain language

Per-tuple memory context

Also called: per-tuple context, ecxt_per_tuple_memory, short-lived expression context

In plain English

The per-tuple memory context is a tiny arena the executor uses for evaluating expressions on a single row (ExprContext.ecxt_per_tuple_memory). It is reset between every row, so scratch memory from one tuple is thrown away before the next is processed.

Why it matters

This is why a function evaluated across 100 million rows doesn’t accumulate 100 million allocations, and why C functions can palloc freely without freeing. The reset between rows is the cleanup. Allocating in a longer-lived context inside a per-row loop, by contrast, is a real leak.

Was this helpful?

← Browse the full glossary