Re: How to stop a query - Mailing list pgsql-general

From Scott Marlowe
Subject Re: How to stop a query
Date
Msg-id CAOR=d=1ayP05Nk0XraDR9FDXbmJj3s-L72W_HjZwjQtqc1TMDA@mail.gmail.com
Whole thread Raw
In response to Re: How to stop a query  (younus <younus.essahli@gmail.com>)
Responses Re: How to stop a query
List pgsql-general
On Thu, Jul 19, 2012 at 3:17 AM, younus <younus.essahli@gmail.com> wrote:
> Hi,
>
> First :
>        ps -ef | grep postgres
> and  kill -9 (PID of your query)

NEVER kill -9 a postgres process unless you've exhausted all other
possibilities, as it forces a restart of all the other backends as
well.  A plain kill (no -9) is usually all you need, and it doesn't
cause all the other backends to restart and flush all shared memory.

> Sec :
> select procpid, datname, usename, client_addr,  current_query from
> pg_stat_activity where current_query!='<IDLE>';
>
> and
>
> SELECT pg_cancel_backend(procpid);

MUCH better way of doing things.

pgsql-general by date:

Previous
From: Atri Sharma
Date:
Subject: Re: How to stop a query
Next
From: younus
Date:
Subject: Re: How to stop a query