Configuration parameter

track_functions — PostgreSQL configuration parameter

Category Run-time Statistics Default none, which disables function statistics tracking

Enables tracking of function call counts and time used.

At a glance

Property Value
Parameter track_functions
Category Run-time Statistics
Default none
Value type enum
Change scope Per-session (SET)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

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.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW track_functions; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'track_functions';.

Tuning guidance

This governs how much activity and timing data the server collects. Collecting more improves visibility in pg_stat_* views and monitoring but adds a little overhead; collecting less is cheaper but blinds your tooling. Enable the tracking your monitoring actually consumes and leave the rest at default.

Reference

PostgreSQL documentation — track_functions.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters