Re: psql 9.3 automatic recovery in progress

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: psql 9.3 automatic recovery in progress
Дата
Msg-id 7F880AF0-E338-4764-B8A9-9FEB990DB7E8@gmail.com
обсуждение исходный текст
Ответ на Re: psql 9.3 automatic recovery in progress  (Periko Support <pheriko.support@gmail.com>)
Ответы Re: psql 9.3 automatic recovery in progress  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
> On 10 Oct 2016, at 21:12, Periko Support <pheriko.support@gmail.com> wrote:
>
>     for pid in idle_record:
>         try:
> #            print "process details",pid
> #            os.system("kill -9 %s" % (int(pid[0]), ))
>             os.kill(int(pid[0]), signal.SIGKILL)
>         except OSError as ex:
>             continue

That query returns PostgreSQL backends and you're sending them SIGKILL. Not a recommended practice far as I know.
Shouldn'tyou rather be sending those kill signals to the clients connecting to the db? 
Worse, apparently at some time in the past (a month ago matching those logs, perhaps?) it used to send kill -9! That's
absolutelya very bad idea. 

While on the topic, there is a PG function to cancel a backend query from within PG:
https://www.postgresql.org/docs/9.5/static/functions-admin.html
I think that's the best way to go about this, and best of all, you can combine that with your select statement.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: psql 9.3 automatic recovery in progress
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: psql 9.3 automatic recovery in progress