Parameter · Developer Options
debug_discard_caches
Aggressively flush system caches for debugging purposes. 0 means use normal caching behavior.
- Default:
0 - Type: integer
- Range: 0 … 0
- Applies: Session (superuser)
In plain words
PostgreSQL caches catalog information (table definitions, functions) in each backend. This setting makes it discard those caches at every opportunity, which is extremely slow but flushes out bugs where code keeps using stale cached data.
On normal packaged servers it does nothing: the only allowed value is 0.
For DBAs and operators
Only works in builds compiled with DISCARD_CACHES_ENABLED (automatic with --enable-cassert). Verified on 18.6 packages:
In a debug build, 1 invalidates every system catalog cache entry at the first possible opportunity; higher values run the invalidation recursively (useful but painfully slow: the regression suite takes hours). It replaced the compile-time macros CLOBBER_CACHE_ALWAYS and CLOBBER_CACHE_RECURSIVELY in PostgreSQL 14. Extension authors use it to test that their code handles concurrent DDL correctly.
Developer option: meant for debugging and testing PostgreSQL itself. Leave it at the default on production servers unless a specific diagnosis calls for it.
How to change it
A superuser (or a role granted SET) can change it per session with SET.