Re: Current query of the PL/pgsql procedure. - Mailing list pgsql-performance

From Craig James
Subject Re: Current query of the PL/pgsql procedure.
Date
Msg-id CAFwQ8rcqt3u+FQMFig54JNq6R-QWgf3UatTT5PjeN=5QDtOHkw@mail.gmail.com
Whole thread Raw
In response to Current query of the PL/pgsql procedure.  (Yuri Levinsky <yuril@celltick.com>)
List pgsql-performance
On Sun, Dec 15, 2013 at 8:18 AM, Yuri Levinsky <yuril@celltick.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,

 

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

 


Attachment

pgsql-performance by date:

Previous
From: Yuri Levinsky
Date:
Subject: Current query of the PL/pgsql procedure.
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Current query of the PL/pgsql procedure.