A debugging parameter for invalidating system catalog cache entries

debug_discard_caches is a configuration parameter instructing PostgreSQL to invalidate each system catalog cache entry at the first possible opportunity.

debug_discard_caches was added in PostgreSQL 14.


The default value for debug_discard_caches is: 0. See the Usage section for exceptions.

Note that debug_discard_caches can only be enabled if PostgreSQL was compiled with the --enable-cassert option, or if DISCARD_CACHES_ENABLED was manually set. Otherwise it is not possible to change the setting.


debug_discard_caches was introduced to obviate the need to set CLOBBER_CACHE_ALWAYS when building PostgreSQL, and makes it possible to dynamically enable/disable the setting.

For backwards compatibility, debug_discard_caches will be set to 1 if CLOBBER_CACHE_ALWAYS was defined, or 3 if CLOBBER_CACHE_RECURSIVE was defined.

From PostgreSQL 14 the option --clobber-cache can be provided to initdb to bootstrap backends with debug_discard_caches will be set to 1.

Change history

  • PostgreSQL 14
    • added (commit 4656e3d6), initially as debug_invalidate_system_caches_always but renamed to debug_discard_caches (commit d68a0039)


Development/testing, GUC configuration item