Re: Kill -9 for a session process caused all the sessions to be killed

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Atul(dot)Goel(at)globaldatapoint(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Kill -9 for a session process caused all the sessions to be killed
Date: 2010-09-23 00:57:47
Message-ID: 4C9AA60B.7080604@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 23/09/2010 12:26 AM, Atul(dot)Goel(at)globaldatapoint(dot)com wrote:
> Hi All,
>
> I by mistake ran a query to update a huge table with around 500000 rows
> and has to kill the session.
>
> I found the process-id from the query select * from pg_stat_activity.

> I killed the process using Kill -9 process_id.

Why kill -9 (SIGKILL)?

Did it not respond to regular SIGTERM (the default for kill) ?

SIGKILL will forcibly terminate a process, with no chance for the
process to flush any half-written buffers, tell other processes it is
being killed, etc. In a system of co-operating processes like the
PostgreSQL server, this is bad.

As per the manual, you should not "kill -9" a backend.

For that matter, you should not as a sysadmin "kill -9" (SIGKILL) any
process at all, unless it fails to respond to SIGTERM after a few
seconds (or longer) and letting it finish whatever it's doing isn't an
option. SIGKILL is a really big hammer.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-09-23 01:00:04 Re: [pgsql-sql] Daily digest v1.3328 (5 messages)
Previous Message David Wilson 2010-09-23 00:40:55 Re: [pgsql-sql] Daily digest v1.3328 (5 messages)