Re: pgmonitor patch for query string

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: pgmonitor patch for query string
Date: 2001-03-14 19:16:00
Message-ID: Pine.BSF.4.33.0103141514460.67623-100000@mobile.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 14 Mar 2001, Peter Eisentraut wrote:

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

I *definitely* like this one ... I've been doing wrappers around my
pg_exec() calls in PHP to do some stats generation to work on "slow
queries", but having it in the backend would be more exact ... and easier
to use then having to modify your apps ...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-03-14 19:28:33 Re: pgmonitor patch for query string
Previous Message Tom Lane 2001-03-14 18:39:09 Re: pgmonitor patch for query string