{"Entry":{"collection":"guc","key":"track_activity_query_size","name":"track_activity_query_size","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Statistics / Cumulative Query and Index Statistics","category_zh":"","changed_in":["9.2","11","13","14","15"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.3","status":"added","to":"8.4"},{"documentation_changed":true,"fields":{"short_desc":{"from":"Sets the size reserved for pg_stat_activity.current_query, in bytes.","to":"Sets the size reserved for pg_stat_activity.query, in bytes."}},"from":"9.1","status":"changed","to":"9.2"},{"documentation_changed":false,"fields":{"unit":{"from":null,"to":"B"}},"from":"10","status":"changed","to":"11"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":false,"fields":{"max_val":{"from":"102400","to":"1048576"}},"from":"12","status":"changed","to":"13"},{"documentation_changed":false,"fields":{"category":{"from":"Resource Usage / Memory","to":"Statistics / Query and Index Statistics Collector"}},"from":"13","status":"changed","to":"14"},{"documentation_changed":false,"fields":{"category":{"from":"Statistics / Query and Index Statistics Collector","to":"Statistics / Cumulative Query and Index Statistics"}},"from":"14","status":"changed","to":"15"}],"content_hash":"dac03b508793d814e977603c26c6884e197d4fc2364c4de4951bd4f600ff365d","context":"","default_changed_in":["11"],"default_history":[{"from":"9.0","to":"10","value":"1024"},{"from":"11","to":"19","value":"1 KiB"}],"editorial":{"advice":{"olap":"Long generated SQL often needs more than 1kB to remain identifiable. Compare truncation frequency and incident needs against the value multiplied by MaxBackends; this setting incurs memory, not repeated clock-read overhead.","oltp":"Choose enough bytes to retain diagnostically useful SQL, then budget approximately that storage across all backend slots rather than active queries alone. Increasing it is a startup shared-memory decision and requires a restart.","small":"Keep the smallest value that preserves useful statement identity. Do not copy a 32kB critical-profile value without multiplying it across connection and worker slots on the small host."},"mechanism":["track_activity_query_size reserves real shared memory for the current-query text of every active session shown in pg_stat_activity.query. It is a byte count fixed at server start.","Long statements are truncated to this storage size; increasing it improves incident context but multiplies memory by the number of backend slots, including configured connection capacity.","It does not change log statement length, pg_stat_statements query-text storage, or application payload limits. Query identifiers can correlate truncated text with other telemetry when compute_query_id is available. Its postmaster context fixes the value at server start; changing it requires a restart."],"pitfalls":["Treating the value as memory only for currently active queries instead of storage reserved across backend slots.","Forgetting that the unit is bytes and multibyte query text can contain fewer characters than the byte count suggests.","Expecting it to change log statement length or pg_stat_statements query-text storage.","Changing it without the required server restart."],"references":[{"title":"PostgreSQL 19 Beta 4: track_activity_query_size","url":"https://www.postgresql.org/docs/19/runtime-config-statistics.html#GUC-TRACK-ACTIVITY-QUERY-SIZE"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["track_activities","max_connections","compute_query_id","log_line_prefix","shared_buffers"],"summary":"track_activity_query_size — Sets the size reserved for pg_stat_activity.query, in bytes. Observed in PG9.0–19 Beta 4; its last measured boot default is 1 KiB in PG19 Beta 4, with postmaster 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.205429+08:00","intro_commit":{},"key":"track_activity_query_size","last_version":"20","max_val":"","min_val":"","name":"track_activity_query_size","position":426,"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":"Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the pg_stat_activity.query field.","short_desc_zh":"","source_rev":"english-manuals:87ea8bf03db3a1443611ea87eeb5511321ef1b47008f4ac6f0e6a6ef288f2144","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"track_activity_query_size","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"track_activity_query_size","SourceRevision":"english-manuals:87ea8bf03db3a1443611ea87eeb5511321ef1b47008f4ac6f0e6a6ef288f2144","Facts":{"boot_val":"1024","category":"Statistics / Cumulative Query and Index Statistics","context":"postmaster","description":"Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the pg_stat_activity.query field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start.","doc":{"anchor":"GUC-TRACK-ACTIVITY-QUERY-SIZE","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"1048576","metadata_version":"18","min_val":"100","name":"track_activity_query_size","short_desc":"Sets the size reserved for pg_stat_activity.query, in bytes.","source":"pg-settings-source-snapshot","unit":"B","vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACK-ACTIVITY-QUERY-SIZE","file":"runtime-config-statistics.html","lang":"en","sha256":"90db46d4b011d54f415934fcc658b0841d07af25ae591483c2139ba0e114ed21","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"track_activity_query_size","SourceDatabase":"center","Version":"18","Locale":"en","Title":"track_activity_query_size","Summary":"Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the pg_stat_activity.query field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start.","BodyHTML":"\u003cp\u003eSpecifies the amount of memory reserved to store the text of the currently executing command for each active session, for the pg_stat_activity.query field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start.\u003c/p\u003e","SourceRevision":"english-manuals:87ea8bf03db3a1443611ea87eeb5511321ef1b47008f4ac6f0e6a6ef288f2144","ContentHash":"db97ffe1e58cbe6e06b4096d6ef364e18a975829ed5a6485b361fea85fee2e9c","Payload":{"description":"Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the pg_stat_activity.query field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start."}},"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}
