# track_cost_delay_timing

> track_cost_delay_timing — Collects timing statistics for cost-based vacuum delay. Observed in PG18–19 Beta 3; its last measured boot default is off 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 timing statistics for cost-based vacuum delay.”

## 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 | `off` | off |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG18 |
| Present in | PG18–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`bb8dff9995f2`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bb8dff9995f2cf501376772898bcbcf58aa05cde) — Add cost-based vacuum delay time to progress views. |
| Commit date | 2025-02-11 |
| Discussion | [thread 1](https://postgr.es/m/ZmaXmWDL829fzAVX%40ip-10-97-1-34.eu-west-3.compute.internal) |

## Default history {#default-history}

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

## How it works {#mechanism}

track_cost_delay_timing measures time actually spent in cost-based VACUUM and ANALYZE delay. The result appears in progress views, verbose command output, and eligible autovacuum logs.

Collection repeatedly reads the operating-system clock and can have platform-dependent overhead. It does not enable vacuum delay or alter vacuum_cost_* policy.

The metric helps distinguish useful work from intentional throttling. pg_test_timing can measure clock-read overhead before enabling it widely. 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 | Enable it when operators need to distinguish VACUUM or ANALYZE work from intentional cost-delay sleep. Measure clock-read overhead with pg_test_timing and under autovacuum load; it is a boolean and does not size or enable cost-based delay itself. |
| OLAP | It is useful when long maintenance overlaps analytical work and throttle time must be quantified. Compare reported delay time with maintenance duration and foreground latency, then keep it on only if the evidence is used operationally. |
| Small nodes | Leave off unless vacuum-delay diagnostics are needed and clock reads are cheap on the platform. Enabling it does not make maintenance faster or slower by policy; vacuum_cost_* settings remain separate. |
{.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 | `on` | different | `'on'` |
| CRIT | `on` | different | `'on'` |
| TINY | Unmodified | — | — |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG18–19 Beta 3 unmodified; OLAP: PG18–19 Beta 3 = on (dcs); CRIT: PG18–19 Beta 3 = on (dcs); TINY: PG18–19 Beta 3 unmodified. Advice, pending human review — Editorial inference, pending maintainer review: The OLAP/crit-only switch is intended to expose time spent in vacuum/analyze cost delays where long maintenance or critical observability justifies clock overhead.

## Common pitfalls {#common-pitfalls}

- Assuming the switch enables cost-based vacuum delay rather than only timing existing delay.
- Ignoring platform-dependent clock-read overhead instead of measuring with pg_test_timing.
- Looking for the metric without enabling the relevant progress, verbose, or autovacuum-log output.
- Treating the boolean as a duration or buffer-size parameter.

## Related parameters {#related-parameters}

[`vacuum_cost_delay`](/parameters/vacuum-cost-delay/) · [`autovacuum_vacuum_cost_delay`](/parameters/autovacuum-vacuum-cost-delay/) · [`log_autovacuum_min_duration`](/parameters/log-autovacuum-min-duration/) · [`track_io_timing`](/parameters/track-io-timing/) · [`vacuum_buffer_usage_limit`](/parameters/vacuum-buffer-usage-limit/)

## References {#references}

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