{"Entry":{"collection":"guc","key":"enable_memoize","name":"enable_memoize","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Method Configuration","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"13","status":"added","to":"14"}],"content_hash":"953bbcc28fdcca411fde5ec46892e56fecb155e7c3ff43c1909dec977d8718a4","context":"","default_changed_in":[],"default_history":[{"from":"14","to":"19","value":"on"}],"editorial":{"advice":{"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.","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.","small":"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."},"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."],"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."],"references":[{"title":"PostgreSQL 19 Beta 4: enable_memoize","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-ENABLE-MEMOIZE"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["enable_nestloop","work_mem","enable_material","cpu_operator_cost"],"summary":"enable_memoize — Enables the planner's use of memoization. Observed in PG14–19 Beta 4; its last measured boot default is on in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"14","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:31.206968+08:00","intro_commit":{"authored_at":"2021-07-14T12:45:00+12:00","discussion":["https://postgr.es/m/20210708165145.GG1176@momjian.us"],"hash":"47ca4836441d1c24f75a94d43af8bd72d4c8d057","subject":"Change the name of the Result Cache node to Memoize","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=47ca4836441d1c24f75a94d43af8bd72d4c8d057"},"key":"enable_memoize","last_version":"20","max_val":"","min_val":"","name":"enable_memoize","position":125,"present_in":["14","15","16","17","18","19","20"],"short_desc":"Enables or disables the query planner's use of memoize plans for caching results from parameterized scans inside nested-loop joins.","short_desc_zh":"","source_rev":"english-manuals:15c3e9a1569f1d3a80c2a1b9bd97dd42c2a06bc450ca1a62b2ec5e2726f6b66d","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"enable_memoize","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"enable_memoize","SourceRevision":"english-manuals:15c3e9a1569f1d3a80c2a1b9bd97dd42c2a06bc450ca1a62b2ec5e2726f6b66d","Facts":{"boot_val":"on","category":"Query Tuning / Planner Method Configuration","context":"user","description":"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.","doc":{"anchor":"GUC-ENABLE-MEMOIZE","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"enable_memoize","short_desc":"Enables the planner's use of memoization.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-ENABLE-MEMOIZE","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"enable_memoize","SourceDatabase":"center","Version":"18","Locale":"en","Title":"enable_memoize","Summary":"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.","BodyHTML":"\u003cp\u003eEnables or disables the query planner\u0026#39;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.\u003c/p\u003e","SourceRevision":"english-manuals:15c3e9a1569f1d3a80c2a1b9bd97dd42c2a06bc450ca1a62b2ec5e2726f6b66d","ContentHash":"7f1f2c155d827e5195ee54172fc3f51074030bbd55f7e0dbd2fc9969a420fc40","Payload":{"description":"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."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
