Configuration parameter

trace_userlocks — PostgreSQL configuration parameter

Category Developer Options

If on, emit information about user lock usage.

At a glance

Property Value
Parameter trace_userlocks
Category Developer Options
Default (see documentation)
Value type boolean (on/off)
Change scope Per-session (SET)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

If on, emit information about user lock usage. Output is the same as for trace_locks, only for advisory locks.

This parameter is only available if the LOCK_DEBUG macro was defined when PostgreSQL was compiled.

(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 trace_userlocks; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'trace_userlocks';.

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 — trace_userlocks.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters