{"Entry":{"collection":"guc","key":"track_counts","name":"track_counts","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":{"category":{"from":"Statistics / Query and Index Statistics Collector","to":"Statistics / Cumulative Query and Index Statistics"}},"from":"14","status":"changed","to":"15"}],"content_hash":"6dfa0a5be38298ca156e15cdde072ad0a08854d7d3f73c0bbbb61d06d7685d81","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"on"}],"editorial":{"advice":{"olap":"Keep track_counts=on for maintenance decisions even if queries are batch oriented. Counter collection is more valuable than the small saving from losing autovacuum inputs.","oltp":"Keep track_counts=on; normal autovacuum and capacity monitoring rely on it. Disable only in a controlled experiment that does not represent a production configuration.","small":"Keep track_counts=on. Small systems still need autovacuum and table-activity visibility."},"mechanism":["track_counts feeds PostgreSQL's cumulative database, table, and index activity counters. Autovacuum depends on these counts to decide when tables need vacuum and analyze.","Turning it off removes planner and maintenance telemetry and can prevent normal autovacuum triggering. It does not reset already stored counters by itself.","The statistics are exposed through pg_stat views under snapshot rules controlled by stats_fetch_consistency. Collection is server-wide, while visibility remains privilege controlled. Its superuser context permits an authorized session change without a server restart."],"pitfalls":["Enabling or enlarging track_counts without measuring collection and observation overhead.","Confusing collection semantics with a performance-control or I/O-control setting.","Assuming all statistics are immediately current inside a long transaction.","Collecting sensitive query text or identifiers without matching access and retention policy."],"references":[{"title":"PostgreSQL 19 Beta 4: track_counts","url":"https://www.postgresql.org/docs/19/runtime-config-statistics.html#GUC-TRACK-COUNTS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["autovacuum","stats_fetch_consistency","track_activities","default_statistics_target","log_autovacuum_min_duration"],"summary":"track_counts — Collects statistics on database activity. 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.213935+08:00","intro_commit":{},"key":"track_counts","last_version":"20","max_val":"","min_val":"","name":"track_counts","position":429,"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 collection of statistics on database activity.","short_desc_zh":"","source_rev":"english-manuals:770f95853fa19ce651c86d73b9330663ed7801c1224539ba43e008029ec9d234","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"track_counts","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"track_counts","SourceRevision":"english-manuals:770f95853fa19ce651c86d73b9330663ed7801c1224539ba43e008029ec9d234","Facts":{"boot_val":"on","category":"Statistics / Cumulative Query and Index Statistics","context":"superuser","description":"Enables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. Only superusers and users with the appropriate SET privilege can change this setting.","doc":{"anchor":"GUC-TRACK-COUNTS","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"track_counts","short_desc":"Collects statistics on database activity.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACK-COUNTS","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"track_counts","SourceDatabase":"center","Version":"18","Locale":"en","Title":"track_counts","Summary":"Enables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. Only superusers and users with the appropriate SET privilege can change this setting.","BodyHTML":"\u003cp\u003eEnables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. Only superusers and users with the appropriate SET privilege can change this setting.\u003c/p\u003e","SourceRevision":"english-manuals:770f95853fa19ce651c86d73b9330663ed7801c1224539ba43e008029ec9d234","ContentHash":"cad727136bfd679ea516dbfda0926bd107f2a2495cc95621023ebdce26d2d733","Payload":{"description":"Enables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. 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}
