Re: How to stop a query

From: Younus <younus(dot)essahli(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to stop a query
Date: 2012-07-19 16:30:06
Message-ID: CABu0ooGBV+Sbti5B+nRDZUB2tbS9OaT_XQfcbD--dhd8N66ShA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Scott,

thank you for your comment

2012/7/19 Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>

> On Thu, Jul 19, 2012 at 3:17 AM, younus <younus(dot)essahli(at)gmail(dot)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.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luiz Damim 2012-07-19 16:37:16 Default value of serial fields changes after restore
Previous Message younus 2012-07-19 16:25:57 Re: How to stop a query