Configuration parameter

enable_memoize — PostgreSQL configuration parameter

Category Query Planning Default on

Enables or disables the query planner’s use of memoize plans for caching results from parameterized scans inside nested-loop joins.

At a glance

Property Value
Parameter enable_memoize
Category Query Planning
Default on
Value type boolean (on/off)
Change scope Per-session (SET)
Available in PostgreSQL 14, 15, 16, 17, 18, 19 (added in 14)

What it does

Enables or disables the query planner’s use of memoize plans for caching results from parameterized scans inside nested-loop joins. This plan type allows scans to the underlying plans to be skipped when the results for the current parameters are already in the cache. Less commonly looked up results may be evicted from the cache when more space is required for new entries. The default is on.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW enable_memoize; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'enable_memoize';.

Tuning guidance

This is a diagnostic switch, not a production tuning knob. Turn it off briefly (per session) to confirm why the planner avoids or prefers a plan, then leave it on. Forcing it off in production masks bad estimates instead of fixing them — fix statistics, costs or indexes instead.

Reference

PostgreSQL documentation — enable_memoize.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters