Configuration parameter

track_counts — PostgreSQL configuration parameter

Category Run-time Statistics

Enables collection of statistics on database activity.

At a glance

Property Value
Parameter track_counts
Category Run-time Statistics
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

Enables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. Only superusers and users with the appropriate SET privilege can change this setting.

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

Tuning guidance

This governs how much activity and timing data the server collects. Collecting more improves visibility in pg_stat_* views and monitoring but adds a little overhead; collecting less is cheaper but blinds your tooling. Enable the tracking your monitoring actually consumes and leave the rest at default.

Reference

PostgreSQL documentation — track_counts.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters