viewing large queries in pg_stat_activity

Started by David Kerrabout 16 years ago5 messagesgeneral
Jump to latest
#1David Kerr
dmk@mr-paradox.net

It seems like pg_stat_activity truncates the current_query to about 1024 characters.

The field is a text, so i'm wondering if there is a way to see the full query?

(I know i can turn on log_statement=all, or log_min_duration_statement) but i'd like
something that doesn't require a restart.

Thanks

Dave

#2Magnus Hagander
magnus@hagander.net
In reply to: David Kerr (#1)
Re: viewing large queries in pg_stat_activity

2010/2/9 David Kerr <dmk@mr-paradox.net>:

It seems like pg_stat_activity truncates the current_query to about 1024 characters.

The field is a text, so i'm wondering if there is a way to see the full query?

(I know i can turn on log_statement=all, or log_min_duration_statement) but i'd like
something that doesn't require a restart.

The data isn't being tracked, so there is no way to show it. The
length of the query tracked can be found in the parameter
track_activity_query_size. Note that increasing that will obviously
increase the overhead of collecting it.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#3David Kerr
dmk@mr-paradox.net
In reply to: Magnus Hagander (#2)
Re: viewing large queries in pg_stat_activity

Magnus Hagander wrote:

2010/2/9 David Kerr <dmk@mr-paradox.net>:

It seems like pg_stat_activity truncates the current_query to about 1024 characters.

The field is a text, so i'm wondering if there is a way to see the full query?

(I know i can turn on log_statement=all, or log_min_duration_statement) but i'd like
something that doesn't require a restart.

The data isn't being tracked, so there is no way to show it. The
length of the query tracked can be found in the parameter
track_activity_query_size. Note that increasing that will obviously
increase the overhead of collecting it.

That's documented in 8.4, does anyone know if it's available in 8.3?

Thanks

Dave

#4Scott Marlowe
scott.marlowe@gmail.com
In reply to: David Kerr (#1)
Re: viewing large queries in pg_stat_activity

On Mon, Feb 8, 2010 at 5:46 PM, David Kerr <dmk@mr-paradox.net> wrote:

It seems like pg_stat_activity truncates the current_query to about 1024 characters.

The field is a text, so i'm wondering if there is a way to see the full query?

(I know i can turn on log_statement=all, or log_min_duration_statement) but i'd like
something that doesn't require a restart.

FYI, log_statement doesn't require a restart, just a reload. In fact
you can turn it on for just one db or user if you want with alter
database / alter user.

#5Guillaume Lelarge
guillaume@lelarge.info
In reply to: David Kerr (#3)
Re: viewing large queries in pg_stat_activity

Le 09/02/2010 17:05, David Kerr a �crit :

Magnus Hagander wrote:

2010/2/9 David Kerr <dmk@mr-paradox.net>:

It seems like pg_stat_activity truncates the current_query to about
1024 characters.

The field is a text, so i'm wondering if there is a way to see the
full query?

(I know i can turn on log_statement=all, or
log_min_duration_statement) but i'd like
something that doesn't require a restart.

The data isn't being tracked, so there is no way to show it. The
length of the query tracked can be found in the parameter
track_activity_query_size. Note that increasing that will obviously
increase the overhead of collecting it.

That's documented in 8.4, does anyone know if it's available in 8.3?

No, it's a new feature of 8.4.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com