GUC Parameters / Statistics
track_counts
Read the PG 18 manualEnables collection of statistics on database activity.
Reading PG 18current·documented in 20 of 24 versions, 8.3 to 20
- Type
- bool
- Context
- superuser
- Measured default
- on
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
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.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | on |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source
How it works
track_counts feeds PostgreSQL's cumulative database, table, and index activity counters. Autovacuum depends on these counts to decide when tables need vacuum and analyze.
Turning it off removes planner and maintenance telemetry and can prevent normal autovacuum triggering. It does not reset already stored counters by itself.
The statistics are exposed through pg_stat views under snapshot rules controlled by stats_fetch_consistency. Collection is server-wide, while visibility remains privilege controlled. Its superuser context permits an authorized session change without a server restart.
Operational considerations
Enabling or enlarging track_counts without measuring collection and observation overhead.
Confusing collection semantics with a performance-control or I/O-control setting.
Assuming all statistics are immediately current inside a long transaction.
Collecting sensitive query text or identifiers without matching access and retention policy.
Workload guidance
OLAP: Keep track_counts=on for maintenance decisions even if queries are batch oriented. Counter collection is more valuable than the small saving from losing autovacuum inputs.
OLTP: Keep track_counts=on; normal autovacuum and capacity monitoring rely on it. Disable only in a controlled experiment that does not represent a production configuration.
SMALL: Keep track_counts=on. Small systems still need autovacuum and table-activity visibility.
Related entries
Further reading
Definition snapshot: english-manuals:770f95853fa19ce651c86d73b93… · English manual source