{"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"}],"derived_content_hash":"ab509ed32f6a85444c21b63f526586c22264d40c3f6ac7d5aa42d3405f1b15de","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"],"repair_provenance":{"original_source_revision":"english-manuals:15c3e9a1569f1d3a80c2a1b9bd97dd42c2a06bc450ca1a62b2ec5e2726f6b66d","receipt_sha256":"05c0e1f8ec5b156b8c8939eb7bbdff71c3d594dac7dae0e4824bc0c3dc2f5e3d","repair":"wiki-repair-20261023"},"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":"wiki-repair-20261023:91bf708ac03e44e334828ce472a030a08c7394013c223a06cbd3f2230f385bb5","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"enable_memoize","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"enable_memoize","SourceRevision":"wiki-repair-20261023:91bf708ac03e44e334828ce472a030a08c7394013c223a06cbd3f2230f385bb5","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.","description_zh":"启用或禁用查询规划器使用 memoize 计划来缓存嵌套循环连接中参数化扫描的结果。当前参数的结果已在缓存中时，这类计划允许跳过对底层计划的扫描。当新条目需要更多空间时，查询频率较低的结果可能会被逐出缓存。默认值是 on。","description_zh_html":"\u003cp\u003e\n        启用或禁用查询规划器使用 memoize 计划来缓存嵌套循环连接中参数化扫描的结果。当前参数的结果已在缓存中时，这类计划允许跳过对底层计划的扫描。当新条目需要更多空间时，查询频率较低的结果可能会被逐出缓存。默认值是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。\n       \u003c/p\u003e","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","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-query.html","sha256":"38b0ec7d6c52647c7cdf6401bda43777b62b324f1821fef3ee0f0f0ddb388513"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"bool","zh_from":"same-version-pgdoc"},"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":"wiki-repair-20261023:91bf708ac03e44e334828ce472a030a08c7394013c223a06cbd3f2230f385bb5","ContentHash":"4dd9cf175ef5497402134a7d2e282f4a5c318e2e160952cb3e817c10c579dbe3","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":"en","Fallback":false,"Versions":["14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
