Skip to content

track_counts

track_counts — Collects statistics on database activity. Observed in PG9.0–19 Beta 3; its last measured boot default is on in PG19 Beta 3, with superuser context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Collects statistics on database activity.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valuesuperuser
Settable at runtime by a superuser
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueStatistics / Cumulative Query and Index Statistics
Upstream classification
Latest boot value , Valueon
on

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 on on

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.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
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.
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.
Small nodes Keep track_counts=on. Small systems still need autovacuum and table-activity visibility.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • 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.

autovacuum · stats_fetch_consistency · track_activities · default_statistics_target · log_autovacuum_min_duration

References