Search Postgresql Archives

psql help

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

 



Hello:

 

Following works-

 

    SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity

    WHERE pid IN (select unnest(pg_blocking_pids(pid)) from pg_stat_activity where cardinality(pg_blocking_pids(pid)) > 0)

                 and usename = 'DBUSER_10'

                 and now() - state_change >= interval $a'${TIMEOUT_MINS}'$a

                 order by now() - state_change >= interval $a'${TIMEOUT_MINS}'$a desc limit 1;

 

How can I rewrite the above in psql and pg_terminate_backend  all pids that meet above criteria (essentially remove limit 1) ?

 

Thanks!

 

Note:

I run this in Linux. TIMEOUT_MINS is env variable.

 

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux