Configuration parameter

track_activity_query_size — PostgreSQL configuration parameter

Category Run-time Statistics Default 1024 bytes Change scope Postmaster

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.

At a glance

Property Value
Parameter track_activity_query_size
Category Run-time Statistics
Default 1024
Value type integer
Change scope Server restart required (postgresql.conf)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

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.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Set it in postgresql.conf (or with ALTER SYSTEM) and restart the server — this parameter cannot change without a restart.

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

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_activity_query_size.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters