{"Entry":{"collection":"guc","key":"track_functions","name":"track_functions","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Statistics / Cumulative Query and Index Statistics","category_zh":"","changed_in":["15"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.3","status":"added","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{"category":{"from":"Statistics / Query and Index Statistics Collector","to":"Statistics / Cumulative Query and Index Statistics"}},"from":"14","status":"changed","to":"15"}],"content_hash":"4c7305742cf22b4bc162f1a08c89a5a4897cf204dacc6df2335c83f398587ba3","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"none"}],"editorial":{"advice":{"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."},"mechanism":["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."],"pitfalls":["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."],"references":[{"title":"PostgreSQL 19 Beta 4: track_functions","url":"https://www.postgresql.org/docs/19/runtime-config-statistics.html#GUC-TRACK-FUNCTIONS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["track_counts","stats_fetch_consistency","compute_query_id","jit_expressions","log_statement_stats"],"summary":"track_functions — Collects function-level statistics on database activity. Observed in PG9.0–19 Beta 4; its last measured boot default is none in PG19 Beta 4, with superuser context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.4","group":"Statistics","group_slug":"statistics","imported_at":"2026-09-27T17:57:32.217065+08:00","intro_commit":{},"key":"track_functions","last_version":"20","max_val":"","min_val":"","name":"track_functions","position":430,"present_in":["8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Enables tracking of function call counts and time used.","short_desc_zh":"","source_rev":"english-manuals:6410852701d20564669efae2c9350e5a014b607c030bf55dc7eb754c5a361b31","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"track_functions","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"track_functions","SourceRevision":"english-manuals:6410852701d20564669efae2c9350e5a014b607c030bf55dc7eb754c5a361b31","Facts":{"boot_val":"none","category":"Statistics / Cumulative Query and Index Statistics","context":"superuser","description":"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. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting.","doc":{"anchor":"GUC-TRACK-FUNCTIONS","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"},"documented":true,"enumvals":["none","pl","all"],"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"track_functions","short_desc":"Collects function-level statistics on database activity.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACK-FUNCTIONS","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"track_functions","SourceDatabase":"center","Version":"18","Locale":"en","Title":"track_functions","Summary":"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. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting.","BodyHTML":"\u003cp\u003eEnables 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. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting.\u003c/p\u003e","SourceRevision":"english-manuals:6410852701d20564669efae2c9350e5a014b607c030bf55dc7eb754c5a361b31","ContentHash":"c8fb8b37b6370b4302dacee257abadbbde78e5485df41d5d6b20770ae2f9d253","Payload":{"description":"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. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
