Re: Current query of the PL/pgsql procedure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 15, 2013 at 8:18 AM, Yuri Levinsky <yuril@xxxxxxxxxxxx> 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

 



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux