From: | Giuseppe Broccolo <giuseppe(dot)broccolo(at)2ndquadrant(dot)it> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Alter table never finishes |
Date: | 2013-07-30 15:56:16 |
Message-ID: | 51F7E220.90006@2ndquadrant.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> How can I force disconnect all clients to let me alter that table?.
>
> Regards,
There are two ways: the first|is based on pg_terminate_backend()
function and 'pg_stat_activity' catalog |||to kill idle processes.
So in a psql session type (tried on PostgreSQL 8.4):
==# SELECT procpid, (SELECT pg_terminate_backend(procid)) AS killed from
pg_stat_activity WHERE current_query LIKE '<IDLE>';
A more heavy handed approach then should be used on terminal, forcing
kill of idle processes using their pid:
:$ for x in `ps -ef | grep -e "postgres.*idle" | awk '{print $2}'`; do
kill -9 $x; done
Hope it can help.
Giuseppe.
--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe(dot)broccolo(at)2ndQuadrant(dot)it | www.2ndQuadrant.it
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2013-07-30 16:17:27 | Re: [BUGS] Incorrect response code after XA recovery |
Previous Message | Klaus Ita | 2013-07-30 15:37:58 | Re: Fwd: corrupted files |