track_functions
Read PG 18 manual ↗Enables tracking of function call counts and time used.
- Type
- enum
- Context
- superuser
- Measured default
- none
- Unit
- —
- Metadata snapshot
- 18
- Allowed values
- none, pl, all
Definition PG 18 manual
Enables tracking of function call counts and time used. Specify pl to track only procedural-language functions, all to also track SQL and C language functions. The default is none, which disables function statistics tracking. Only superusers and users with the appropriate SET privilege can change this setting.
SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | none |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
track_functions counts calls and execution time for procedural functions with pl, and also SQL/C functions with all. none disables function-level cumulative statistics.
Simple SQL-language functions that the planner inlines disappear into the caller and are not tracked regardless of this setting. Nested function time is reported through the statistics system's own total/self accounting.
all broadens instrumentation and can add overhead on function-heavy workloads. The counters are cumulative and observed through pg_stat_user_functions or related views. Its superuser context permits an authorized session change without a server restart.
Operational considerations
Expecting inlined SQL-language functions to appear in function statistics.
Enabling all cluster-wide without measuring instrumentation overhead on function-heavy workloads.
Reading cumulative total and self time without accounting for nested calls and snapshot behavior.
Treating none, pl, and all as levels of sampling rather than different instrumentation scopes.
Workload guidance
OLAP: Enable pl or all for a bounded analysis when time inside functions must be separated from caller time. Remember that simple SQL functions may be inlined and remain invisible, so absence from the view is not proof of no execution.
OLTP: Keep none unless function-level call counts and timing answer a concrete production question. Use pl to limit instrumentation to procedural languages, or all only after measuring overhead on function-heavy traffic.
SMALL: Prefer none or a short scoped diagnostic interval. The enum controls instrumentation breadth; it is not a numeric sampling rate, and all can add disproportionate overhead on a CPU-limited host.
Version history 2
- PG 14 → 15changed
- PG 9.6 → 10changed
Related entries
Further reading
Definition snapshot: english-manuals:d25be9de65571538762e927f7be… · English manual source