{"Entry":{"collection":"guc","key":"track_activities","name":"track_activities","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.2","status":"added","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"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":"f4956dd897ddca9c21fef17ee0baa69e2ca82ea57f962b3c676eede8c2a317de","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"on"}],"editorial":{"advice":{"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.","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.","small":"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."},"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."],"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."],"references":[{"title":"PostgreSQL 19 Beta 4: track_activities","url":"https://www.postgresql.org/docs/19/runtime-config-statistics.html#GUC-TRACK-ACTIVITIES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["track_activity_query_size","track_counts","compute_query_id","log_line_prefix","log_min_duration_statement"],"summary":"track_activities — Collects information about executing commands. Observed in PG9.0–19 Beta 4; its last measured boot default is on in PG19 Beta 4, with superuser context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.3","group":"Statistics","group_slug":"statistics","imported_at":"2026-09-27T17:57:32.201975+08:00","intro_commit":{},"key":"track_activities","last_version":"20","max_val":"","min_val":"","name":"track_activities","position":425,"present_in":["8.3","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 the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution.","short_desc_zh":"","source_rev":"english-manuals:84a259c57e15715feaba60e1a9a065be2a3194b8e59285a0ef247b8caf73eccb","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"track_activities","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"track_activities","SourceRevision":"english-manuals:84a259c57e15715feaba60e1a9a065be2a3194b8e59285a0ef247b8caf73eccb","Facts":{"boot_val":"on","category":"Statistics / Cumulative Query and Index Statistics","context":"superuser","description":"Enables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. This parameter is on by default. Note that even when enabled, this information is only visible to superusers, roles with privileges of the pg_read_all_stats role and the user owning the sessions being reported on (including sessions belonging to a role they have the privileges of), so it should not represent a security risk. Only superusers and users with the appropriate SET privilege can change this setting.","doc":{"anchor":"GUC-TRACK-ACTIVITIES","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"Enables the collection of information on the currently executing command of each session, along with the time at which that command began execution.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"track_activities","short_desc":"Collects information about executing commands.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACK-ACTIVITIES","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"track_activities","SourceDatabase":"center","Version":"18","Locale":"en","Title":"track_activities","Summary":"Enables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. This parameter is on by default. Note that even when enabled, this information is only visible to superusers, roles with privileges of the pg_read_all_stats role and the user owning the sessions being reported on (including sessions belonging to a role they have the privileges of), so it should not represent a security risk. Only superusers and users with the appropriate SET privilege can change this setting.","BodyHTML":"\u003cp\u003eEnables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. This parameter is on by default. Note that even when enabled, this information is only visible to superusers, roles with privileges of the pg_read_all_stats role and the user owning the sessions being reported on (including sessions belonging to a role they have the privileges of), so it should not represent a security risk. Only superusers and users with the appropriate SET privilege can change this setting.\u003c/p\u003e","SourceRevision":"english-manuals:84a259c57e15715feaba60e1a9a065be2a3194b8e59285a0ef247b8caf73eccb","ContentHash":"2c0ad9b98f3fbdb03bea6c10274200bef983f1487bfb8751e080b3954e00b3c9","Payload":{"description":"Enables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. This parameter is on by default. Note that even when enabled, this information is only visible to superusers, roles with privileges of the pg_read_all_stats role and the user owning the sessions being reported on (including sessions belonging to a role they have the privileges of), so it should not represent a security risk. Only superusers and users with the appropriate SET privilege can change this setting."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.3","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}
