Re: Alter table never finishes - Mailing list pgsql-general

From bricklen
Subject Re: Alter table never finishes
Date
Msg-id CAGrpgQ_JJW553XzdDB0LJ9FMTg61_dTrxMTO=2AgOtOHbLrZWQ@mail.gmail.com
Whole thread Raw
In response to Re: Alter table never finishes  (Leonardo M. Ramé <l.rame@griensu.com>)
Responses Re: Alter table never finishes
List pgsql-general

On Tue, Jul 30, 2013 at 10:29 AM, Leonardo M. Ramé <l.rame@griensu.com> 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.

pgsql-general by date:

Previous
From: Leonardo M. Ramé
Date:
Subject: Re: Alter table never finishes
Next
From: Alvaro Herrera
Date:
Subject: Re: Alter table never finishes