2

I query pg_stat_activity. The column query is of type text. The queries can be very long.

The client psql truncates very long queries.

What should I do to see the full query?

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
ericj
  • 2,138
  • 27
  • 44
  • 1
    Possible duplicated: http://stackoverflow.com/questions/1135266/queries-in-pg-stat-activity-are-truncated – McNets Nov 23 '16 at 09:15
  • Possible duplicate of [Truncating display by default in postgres psql select statements](http://stackoverflow.com/questions/33875295/truncating-display-by-default-in-postgres-psql-select-statements) – e4c5 Nov 23 '16 at 09:15
  • see also https://github.com/dbcli/pgcli/issues/1223 – Andrew Aug 26 '22 at 17:34

1 Answers1

2

psql does not. try running smth like

select lpad('a',3000,'b');

Instead it is limited in postgresql.conf, try:

b=# show track_activity_query_size;
 track_activity_query_size
---------------------------
 1024
(1 row)

According to docs:

track_activity_query_size (integer)

Specifies the number of bytes reserved to track the currently executing command for each active session, for the pg_stat_activity.query field. The default value is 1024. This parameter can only be set at server start.

Community
  • 1
  • 1
Vao Tsun
  • 47,234
  • 13
  • 100
  • 132