Pazartesi, Şubat 24, 2014

Postgresql get running queries and kill a long running query


SELECT datname,procpid,current_query FROM pg_stat_activity;

template1=# SELECT datname,procpid,current_query FROM pg_stat_activity;
  datname  | procpid |                                   current_query                                  
-----------+---------+-----------------------------------------------------------------------------------
 pguser    |   22438 | in transaction
 template1 |   24692 | SELECT datname,procpid,current_query FROM pg_stat_activity;
(2 rows)

SELECT pg_cancel_backend(pid of the postgres process); 

Hiç yorum yok: