On Tue, Jul 30, 2013 at 10:29 AM, Leonardo M. Ramé <l.rame@xxxxxxxxxxx> wrote:
> > select pg_cancel_backend(pid) from pg_stat_activity where pid <>
> > pg_backend_pid();
As Giuseppe mentioned, if you need to kill not just the queries, but the connection as well, you could use:
select pg_terminate_backend(pid) from pg_stat_activity where pid <> pg_backend_pid();
That is much safer than kill -9, which if issued against the parent postgres process will crash your cluster.
Sorry bricklen, I've killed all idle connections with "kill -9 <PID>",
then I was able to execute the alter table.
No problem.