Re: idle users
| От | Scott Marlowe |
|---|---|
| Тема | Re: idle users |
| Дата | |
| Msg-id | dcc563d10903051857n1bdb50e0q526504b29cf9d2ec@mail.gmail.com обсуждение исходный текст |
| Ответ на | idle users (paulo matadr <saddoness@yahoo.com.br>) |
| Список | pgsql-general |
On Thu, Mar 5, 2009 at 5:50 AM, paulo matadr <saddoness@yahoo.com.br> wrote:
> I need to procedure to kill users in idle,anybody have this made?
> thanks
> Paulo Moraes
Here's a really primitive bash script to kill off all idle
connections. Run it as postgres:
#!/bin/bash
for i in `psql -U postgres -t -c "select procpid from pg_stat_activity
where current_query like '%<IDLE> in transaction%' and current_query
not ilike '%from pg_stat_activity%';"` ;do
echo $i;
kill $i;
done;
Note that the psql -U line shouldn't be wrapped, unwrap it if you
can't see it in its original glory.
I make no promises that this thing won't eat your machine or anything
else. works on my laptop.
В списке pgsql-general по дате отправления: