Re: Alter table never finishes

From: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
To: Giuseppe Broccolo <giuseppe(dot)broccolo(at)2ndquadrant(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Alter table never finishes
Date: 2013-07-30 17:07:58
Message-ID: 20130730170758.GH7183@leonardo-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 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
>

Thanks to both, Giuseppe and Bricklen. As I have 9.2 I've used:

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 never ends...Any
hint?.

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 351 6629292

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2013-07-30 17:26:39 Re: Alter table never finishes
Previous Message Alvaro Herrera 2013-07-30 16:17:27 Re: [BUGS] Incorrect response code after XA recovery