# track_activities

> track_activities — Collects information about executing commands. 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 information about executing commands.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `bool` | Upstream pg_settings type |
| Context | `superuser` | Settable at runtime by a superuser |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Statistics / Cumulative Query and Index Statistics | Upstream classification |
| Latest boot value | `on` | on |
{.fields meta="-"}

## Lifecycle {#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 {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0–19 Beta 3 | `on` | — | on |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

track_activities records each session's current command, query identifier, and timing metadata for pg_stat_activity. Access remains privilege-filtered even when collection is enabled.

Turning it off removes essential live observability but does not terminate or speed up the command itself. The text stored per session is bounded by track_activity_query_size.

The switch can be changed by authorized users, so monitoring should detect sessions reporting disabled activity. It is separate from cumulative counters controlled by track_counts. Its superuser context permits an authorized session change without a server restart.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Keep on in production so pg_stat_activity can show the current command, query ID, and timing needed for incident response. Restrict view privileges and size track_activity_query_size separately rather than disabling activity collection to hide text. |
| OLAP | Keep on for long analytical sessions; live phase and wait context is especially valuable during resource contention. If overhead is suspected, measure it explicitly before accepting the observability loss from off. |
| Small nodes | Keep on. The setting is a boolean collection gate, not a buffer size; reduce query-text memory with track_activity_query_size only after preserving enough text for diagnosis. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!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 {#common-pitfalls}

- Turning it off and losing the current-command evidence needed to diagnose blocking or runaway sessions.
- Confusing live activity collection with cumulative counters controlled by track_counts.
- Assuming on makes every session's query text visible to every role; visibility remains privilege filtered.
- Ignoring that an authorized session can disable its own activity reporting in the permitted context.

## Related parameters {#related-parameters}

[`track_activity_query_size`](/parameters/track-activity-query-size/) · [`track_counts`](/parameters/track-counts/) · [`compute_query_id`](/parameters/compute-query-id/) · [`log_line_prefix`](/parameters/log-line-prefix/) · [`log_min_duration_statement`](/parameters/log-min-duration-statement/)

## References {#references}

- [PostgreSQL 19 Beta 3 — track_activities](https://www.postgresql.org/docs/19/runtime-config-statistics.html#GUC-TRACK-ACTIVITIES)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
