# enable_memoize

> enable_memoize — Enables the planner's use of memoization. Observed in PG14–19 Beta 3; its last measured boot default is on in PG19 Beta 3, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Enables the planner's use of memoization.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `bool` | Upstream pg_settings type |
| Context | `user` | Settable by an ordinary user |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Query Tuning / Planner Method Configuration | Upstream classification |
| Latest boot value | `on` | on |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG14 |
| Present in | PG14–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`47ca4836441d`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=47ca4836441d1c24f75a94d43af8bd72d4c8d057) — Change the name of the Result Cache node to Memoize |
| Commit date | 2021-07-14 |
| Discussion | [thread 1](https://postgr.es/m/20210708165145.GG1176@momjian.us) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG14–19 Beta 3 | `on` | — | on |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

enable_memoize controls whether the planner may choose Memoize nodes that cache parameterized inner-scan results inside nested-loop joins.

It is consulted while a plan is built. A session-level change is useful for comparing EXPLAIN alternatives, but an already cached plan is not retroactively rewritten; invalidation or replanning is required to observe a different choice.

The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Keep the upstream default for routine OLTP. Use a transaction- or session-local change to diagnose whether choosing Memoize nodes that cache parameterized inner-scan results inside nested-loop joins explains a regression, then repair statistics, indexes, estimates, or query shape instead of leaving a cluster-wide method ban. |
| OLAP | Benchmark representative analytical plans with and without enable_memoize. Judge planning time, memory, spill, and execution time together; a win for one report is not evidence for a global setting. |
| Small nodes | Do not use enable_memoize as a permanent hint on a small host. Resource pressure may change the best method, so verify with EXPLAIN (ANALYZE, BUFFERS) and keep the change scoped to the affected workload if it is still needed. |
{.full-width}

## Pigsty {#pigsty}

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

| Template | Effective value | Versus upstream boot | Source expression |
| --- | --- | --- | --- |
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG14–19 Beta 3 unmodified; OLAP: PG14–19 Beta 3 unmodified; CRIT: PG14–19 Beta 3 unmodified; TINY: PG14–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

## Common pitfalls {#common-pitfalls}

- Treating enable_memoize as a query hint even though it affects every plan built in its scope.
- Testing an already cached prepared plan and concluding that the setting has no effect.
- Masking stale statistics or cardinality errors by disabling a plan method globally.
- The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself.

## Related parameters {#related-parameters}

[`enable_nestloop`](/parameters/enable-nestloop/) · [`work_mem`](/parameters/work-mem/) · [`enable_material`](/parameters/enable-material/) · [`cpu_operator_cost`](/parameters/cpu-operator-cost/)

## References {#references}

- [PostgreSQL 19 Beta 3 — enable_memoize](https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-ENABLE-MEMOIZE)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
