Re: Current query of the PL/pgsql procedure.

From: Craig James <cjames(at)emolecules(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Current query of the PL/pgsql procedure.
Date: 2013-12-15 18:05:10
Message-ID: CAFwQ8rcqt3u+FQMFig54JNq6R-QWgf3UatTT5PjeN=5QDtOHkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, Dec 15, 2013 at 8:18 AM, Yuri Levinsky <yuril(at)celltick(dot)com> wrote:

> Dear ALL,
>
> I am running PL/pgsql procedure with sql statements that taking a long
> time. I able to see them in the log just after their completion. How can I
> see currently running SQL statement? I am able to see in pg_stat_activity
> only my call to function. Many thanks in advance.
>

pg_stat_activity is the right table, but you have to be the super-user to
see queries by others. Here's what I use:

$ psql -U postgres
postgres=# select procpid, datname, usename, current_query from
pg_stat_activity where current_query !~ '<IDLE>';

Craig

>
> *Sincerely yours*,
>
>
>
> [image: Description: Celltick logo_highres]
>
> Yuri Levinsky, DBA
>
> Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel
>
> Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222
>
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message hubert depesz lubaczewski 2013-12-16 10:26:19 Re: Current query of the PL/pgsql procedure.
Previous Message Yuri Levinsky 2013-12-15 16:18:18 Current query of the PL/pgsql procedure.