Re: Alter table never finishes

Поиск
Список
Период
Сортировка
От Giuseppe Broccolo
Тема Re: Alter table never finishes
Дата
Msg-id 51F7E220.90006@2ndquadrant.it
обсуждение исходный текст
Ответ на Alter table never finishes  (Leonardo M. Ramé <l.rame@griensu.com>)
Ответы Re: Alter table never finishes  (Leonardo M. Ramé <l.rame@griensu.com>)
Список pgsql-general
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.broccolo@2ndQuadrant.it | www.2ndQuadrant.it

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Jenkinson
Дата:
Сообщение: Re: [BUGS] Incorrect response code after XA recovery
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [BUGS] Incorrect response code after XA recovery