Re: pg_stat_get_backen_last_activity() ??? - Mailing list pgsql-general

From Tom Lane
Subject Re: pg_stat_get_backen_last_activity() ???
Date
Msg-id 19691.1042845790@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_stat_get_backen_last_activity() ???  (Sean Chittenden <sean@chittenden.org>)
Responses Re: pg_stat_get_backen_last_activity() ???
List pgsql-general
Sean Chittenden <sean@chittenden.org> writes:
> I can already identify that.  Using the PID of the backend + sockstat
> on both the DB server and on the remote www server I can get the PID
> of the webserver process causing the problem, but I have no clue which
> customer, which page, which query, etc.  The www process is doing
> something along the lines of:

> BEGIN;
> SELECT....
> [waits forever]
> END;

Oh, you want to know the actual current query.  Turn on
stats_command_string or whatever it's called.  See the statistics
collector documentation.

If this is after-the-fact (ie, you want to know about a process that's
hung right now), attach to it with a debugger and print out
debug_query_string.

            regards, tom lane

pgsql-general by date:

Previous
From: Sean Chittenden
Date:
Subject: Re: pg_stat_get_backen_last_activity() ???
Next
From: Jon Swinth
Date:
Subject: Re: Fix FK deadlock, but no magic please