pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Tena Sakai <tsakai@gallo.ucsf.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: reading pg_stat_activity view
Date: Thu, 13 Dec 2007 15:57:27 -0600
Message-ID: <dcc563d10712131357g1fbf10e5o1f1b3440a0a71082@mail.gmail.com> (raw)
In-Reply-To: <FE44E0D7EAD2ED4BB2165071DB8E328C03062E1A@egcrc-ex01.egcrc.org>
References: <FE44E0D7EAD2ED4BB2165071DB8E328C03062E18@egcrc-ex01.egcrc.org>
	<dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com>
	<FE44E0D7EAD2ED4BB2165071DB8E328C03062E1A@egcrc-ex01.egcrc.org>

On Dec 13, 2007 3:43 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
>
>  My next question:
>  What would be a good way to tell if some
>  query is hung?

That would really depend on what you mean by hung.  Just running a
really long time, or waiting for a lock that some other session is not
will to commit / rollback like above?

I take it you just mean long running queries.  You can do a couple of
things.  You can set the value for statement_timeout and any statement
that takes over that amount of time will generate a timeout and you
then log it in the logs.

You can use pg_stat_activity to see how long a query's been running.
Something like

select datname, usename, current_query, waiting, now() - query_start
from pg_stat_activity order by query_start;

can show you how long each query has been running.



view thread (11+ messages)  latest in thread

Message-ID: <dcc563d10712131357g1fbf10e5o1f1b3440a0a71082@mail.gmail.com>
Permalink:  ../dcc563d10712131357g1fbf10e5o1f1b3440a0a71082@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10712131357g1fbf10e5o1f1b3440a0a71082@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, tsakai@gallo.ucsf.edu
  Subject: Re: reading pg_stat_activity view
  In-Reply-To: <dcc563d10712131357g1fbf10e5o1f1b3440a0a71082@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox