Re: [GENERAL] Alter table never finishes

2013-07-30 Thread bricklen
On Tue, Jul 30, 2013 at 10:34 AM, bricklen wrote: > Sorry bricklen, I've killed all idle connections with "kill -9 ", > >> then I was able to execute the alter table. >> > > No problem. > btw, I meant 'no need to apologize that the queries were gone', not that I recommend "kill -9" (I don't!)

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread Alvaro Herrera
Leonardo M. Ramé escribió: > Sorry bricklen, I've killed all idle connections with "kill -9 ", > then I was able to execute the alter table. I don't think that was such a great idea. Once you killed the first one, postmaster terminated all other server processes, run recovery, and restarted serv

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread bricklen
On Tue, Jul 30, 2013 at 10:29 AM, Leonardo M. Ramé 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)

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread Leonardo M . Ramé
On 2013-07-30 10:26:39 -0700, bricklen wrote: > On Tue, Jul 30, 2013 at 10:07 AM, Leonardo M. Ramé wrote: > > > > > select pg_cancel_backend(pid) from pg_stat_activity where pid <> > > pg_backend_pid(); > > > > And it returned this: > > > > pg_cancel_backend > > --- > > t > > t >

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread bricklen
On Tue, Jul 30, 2013 at 10:07 AM, Leonardo M. Ramé wrote: > > select pg_cancel_backend(pid) from pg_stat_activity where pid <> > pg_backend_pid(); > > And it returned this: > > pg_cancel_backend > --- > t > t > (2 rows) > > But when I execute my update table command, it still nev

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread Leonardo M . Ramé
On 2013-07-30 17:56:16 +0200, Giuseppe Broccolo wrote: > >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 ses

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread Giuseppe Broccolo
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

Re: [GENERAL] Alter table never finishes

2013-07-30 Thread bricklen
On Tue, Jul 30, 2013 at 7:50 AM, Leonardo M. Ramé 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 Postgre

[GENERAL] Alter table never finishes

2013-07-30 Thread Leonardo M . Ramé
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?. Regards, -- Leonardo M. Ramé Medical IT - Griensu S.A. Av. Colón 636 - Piso 8 Of. A X5000E