{"Entry":{"collection":"guc","key":"debug_discard_caches","name":"debug_discard_caches","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Developer Options","category_zh":"","changed_in":["18"],"changes":[{"documentation_changed":false,"fields":{},"from":"13","status":"added","to":"14"},{"documentation_changed":false,"fields":{"extra_desc":{"from":null,"to":"0 means use normal caching behavior."}},"from":"17","status":"changed","to":"18"}],"content_hash":"293402bcb53795602450870a18a337dca3601634189b872aacafc21a0dc1676d","context":"","default_changed_in":[],"default_history":[{"from":"14","to":"19","value":"0"}],"editorial":{"advice":{"olap":"Long analytical runs can amplify debug_discard_caches's debug overhead and artifacts. Prefer standard EXPLAIN and statistics first, and isolate any developer experiment from normal users.","oltp":"Do not tune production OLTP with debug_discard_caches. Enable it only for a bounded reproduction with an owner, log/disk budget, rollback condition, and evidence-capture plan; restore the default immediately afterward.","small":"Keep debug_discard_caches at its upstream default. A small host has less spare CPU, disk, connection, and log capacity for developer instrumentation."},"mechanism":["debug_discard_caches invalidates system-catalog cache entries at the earliest opportunity; higher values recurse the behavior. Nonzero values make the server extremely slow to expose cache invalidation bugs.","It is supported only in builds compiled with DISCARD_CACHES_ENABLED, automatically associated with --enable-cassert. Production builds keep zero and reject attempts to change it.","The parameter tests correctness under pathological cache churn. It does not flush shared_buffers, the operating-system page cache, or ordinary query result caches. Its superuser context permits an authorized session change without a server restart."],"pitfalls":["Leaving debug_discard_caches enabled after the bounded diagnostic or recovery task.","Running the experiment on the only copy of production data.","Underestimating log, core-file, temporary-file, WAL, CPU, or connection-slot amplification.","Treating a server that merely starts or completes a query as proof that data and behavior are correct."],"references":[{"title":"PostgreSQL 19 Beta 4: debug_discard_caches","url":"https://www.postgresql.org/docs/19/runtime-config-developer.html#GUC-DEBUG-DISCARD-CACHES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["ignore_system_indexes","shared_buffers","debug_parallel_query","allow_system_table_mods"],"summary":"debug_discard_caches — Aggressively flush system caches for debugging purposes. Observed in PG14–19 Beta 4; its last measured boot default is 0 in PG19 Beta 4, with superuser context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"14","group":"Developer Options","group_slug":"developer","imported_at":"2026-09-27T17:57:31.041762+08:00","intro_commit":{"authored_at":"2021-07-13T15:01:01-04:00","discussion":["https://postgr.es/m/1374320.1625430433@sss.pgh.pa.us"],"hash":"6201fa3c166fe2383dd44a9dd5082bc748c2937a","subject":"Rename debug_invalidate_system_caches_always to debug_discard_caches.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=6201fa3c166fe2383dd44a9dd5082bc748c2937a"},"key":"debug_discard_caches","last_version":"20","max_val":"","min_val":"","name":"debug_discard_caches","position":85,"present_in":["14","15","16","17","18","19","20"],"short_desc":"When set to 1, each system catalog cache entry is invalidated at the first possible opportunity, whether or not anything that would render it invalid really occurred.","short_desc_zh":"","source_rev":"english-manuals:c6618266a4ec8995b13afa049ced23a4f99414e6e7565d059b06672ff6614c20","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"debug_discard_caches","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"debug_discard_caches","SourceRevision":"english-manuals:c6618266a4ec8995b13afa049ced23a4f99414e6e7565d059b06672ff6614c20","Facts":{"boot_val":"0","category":"Developer Options","context":"superuser","description":"When set to 1, each system catalog cache entry is invalidated at the first possible opportunity, whether or not anything that would render it invalid really occurred. Caching of system catalogs is effectively disabled as a result, so the server will run extremely slowly. Higher values run the cache invalidation recursively, which is even slower and only useful for testing the caching logic itself. The default value of 0 selects normal catalog caching behavior. This parameter can be very helpful when trying to trigger hard-to-reproduce bugs involving concurrent catalog changes, but it is otherwise rarely needed. See the source code files inval.c and pg_config_manual.h for details. This parameter is supported when DISCARD_CACHES_ENABLED was defined at compile time (which happens automatically when using the configure option --enable-cassert). In production builds, its value will always be 0 and attempts to set it to another value will raise an error.","doc":{"anchor":"GUC-DEBUG-DISCARD-CACHES","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"0 means use normal caching behavior.","lang":"en","max_val":"0","metadata_version":"18","min_val":"0","name":"debug_discard_caches","short_desc":"Aggressively flush system caches for debugging purposes.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-DEBUG-DISCARD-CACHES","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"debug_discard_caches","SourceDatabase":"center","Version":"18","Locale":"en","Title":"debug_discard_caches","Summary":"When set to 1, each system catalog cache entry is invalidated at the first possible opportunity, whether or not anything that would render it invalid really occurred. Caching of system catalogs is effectively disabled as a result, so the server will run extremely slowly. Higher values run the cache invalidation recursively, which is even slower and only useful for testing the caching logic itself. The default value of 0 selects normal catalog caching behavior. This parameter can be very helpful when trying to trigger hard-to-reproduce bugs involving concurrent catalog changes, but it is otherwise rarely needed. See the source code files inval.c and pg_config_manual.h for details. This parameter is supported when DISCARD_CACHES_ENABLED was defined at compile time (which happens automatically when using the configure option --enable-cassert). In production builds, its value will always be 0 and attempts to set it to another value will raise an error.","BodyHTML":"\u003cp\u003eWhen set to 1, each system catalog cache entry is invalidated at the first possible opportunity, whether or not anything that would render it invalid really occurred. Caching of system catalogs is effectively disabled as a result, so the server will run extremely slowly. Higher values run the cache invalidation recursively, which is even slower and only useful for testing the caching logic itself. The default value of 0 selects normal catalog caching behavior. This parameter can be very helpful when trying to trigger hard-to-reproduce bugs involving concurrent catalog changes, but it is otherwise rarely needed. See the source code files inval.c and pg_config_manual.h for details. This parameter is supported when DISCARD_CACHES_ENABLED was defined at compile time (which happens automatically when using the configure option --enable-cassert). In production builds, its value will always be 0 and attempts to set it to another value will raise an error.\u003c/p\u003e","SourceRevision":"english-manuals:c6618266a4ec8995b13afa049ced23a4f99414e6e7565d059b06672ff6614c20","ContentHash":"7bb3805eb7c1d60071444aa9ecca7c1a60f7c09fbfc6fd0eab6d857715001d0f","Payload":{"description":"When set to 1, each system catalog cache entry is invalidated at the first possible opportunity, whether or not anything that would render it invalid really occurred. Caching of system catalogs is effectively disabled as a result, so the server will run extremely slowly. Higher values run the cache invalidation recursively, which is even slower and only useful for testing the caching logic itself. The default value of 0 selects normal catalog caching behavior. This parameter can be very helpful when trying to trigger hard-to-reproduce bugs involving concurrent catalog changes, but it is otherwise rarely needed. See the source code files inval.c and pg_config_manual.h for details. This parameter is supported when DISCARD_CACHES_ENABLED was defined at compile time (which happens automatically when using the configure option --enable-cassert). In production builds, its value will always be 0 and attempts to set it to another value will raise an error."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
