From: | bricklen <bricklen(at)gmail(dot)com> |
---|---|
To: | Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com> |
Cc: | PostgreSql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Alter table never finishes |
Date: | 2013-07-30 15:17:50 |
Message-ID: | CAGrpgQ_MEFEOALfeLmDXjtA2VuoCndKowGgd_LuZJxuLgAT43g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jul 30, 2013 at 7:50 AM, Leonardo M. Ramé <l(dot)rame(at)griensu(dot)com>wrote:
> Hi, I need to do an alter table on a small table (~300 records), but it
> never ends. It may be because there are clients using that table.
>
> How can I force disconnect all clients to let me alter that table?.
>
If you are using PostgreSQL 9.2+, you can use this:
select pg_cancel_backend(pid) from pg_stat_activity where pid <>
pg_backend_pid();
If you are using earlier version, replace "pid" with "procpid".
That query will cancel all queries other than the session issuing the
pg_cancel_backend() calls.
From | Date | Subject | |
---|---|---|---|
Next Message | Klaus Ita | 2013-07-30 15:18:37 | Re: Fwd: corrupted files |
Previous Message | bricklen | 2013-07-30 15:13:20 | Re: Fwd: corrupted files |