Re: pgmonitor patch for query string - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: pgmonitor patch for query string
Date
Msg-id Pine.LNX.4.30.0103141923030.1211-100000@peter.localdomain
Whole thread Raw
In response to pgmonitor patch for query string  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: pgmonitor patch for query string  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
Bruce Momjian writes:

> It does this by creating a global variable 'debug_query_string' and
> assigning it when the query begins and clearing it when the query ends.

You can find out the current query for a given backend by configuring the
server with "debug_print_query on" and "log_pids on" and running

sed -n "/[$pid]/"'s/^.*query: \(.*\)$/\1/p' $logfile

This doesn't tell you whether the query is still running, but ps tells you
that.  In fact, it might be an idea to add a logging option that prints
something like "query finished in xxx ms".  We actually have something
similar hidden under show_query_stats, but the formatting needs to be made
more convenient and possibly less verbose.  But at least this way you have
it for the record, and not only on the screen.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pgmonitor patch for query string
Next
From: Roland Roberts
Date:
Subject: Re: AW: Re: Week number