Configuration parameter

debug_discard_caches — PostgreSQL configuration parameter

Category Developer Options

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.

At a glance

Property Value
Parameter debug_discard_caches
Category Developer Options
Default 0
Value type integer
Change scope Per-session (SET)
Available in PostgreSQL 14, 15, 16, 17, 18, 19 (added in 14)

What it does

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.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW debug_discard_caches; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'debug_discard_caches';.

Tuning guidance

This is a developer and debugging aid, not a performance knob. Leave it at the default in production; enable it only temporarily, on a non-production or carefully controlled system, while diagnosing a specific problem. Several options in this group add overhead, generate large volumes of log output, or can damage data if misused — turn them off again as soon as the investigation is done.

Reference

PostgreSQL documentation — debug_discard_caches.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters