pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Mageshwaran <j_mageshwaran@sifycorp.com>
Cc: pgsql-general@postgresql.org, pgsql-admin@postgresql.org, Postgres <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Kill a Long Running Query
Date: Wed, 25 Apr 2007 15:56:50 +0100
Message-ID: <462F6C32.5010604@enterprisedb.com> (raw)
In-Reply-To: <462F66C1.4030303@sifycorp.com>
References: <462F66C1.4030303@sifycorp.com>

Please don't cross-post to multiple mailing lists. And pgsql-hackers is 
not the correct list for basic usage questions. And long end-of-mail 
disclaimers are not generally appreciated.

Mageshwaran wrote:
> Any body tell me how to kill a long running query in postgresql, is 
> there any statement to kill a query, 

See the user manual on administration functions, pg_cancel_backend in 
particular:

http://www.postgresql.org/docs/8.2/interactive/functions-admin.html

Basically you issue a "SELECT * FROM pg_stat_activity", or plain ps to 
find out the pid of the backend executing the long running query, and 
then use pg_cancel_backend (or kill -INT) to cancel it.

> and also tell me how to log slow queries to a log file.

Using the log_min_duration_statement configuration variable.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (6+ messages)  latest in thread

Message-ID: <462F6C32.5010604@enterprisedb.com>
Permalink:  ../462F6C32.5010604@enterprisedb.com/
Also on:    postgresql.org/message-id/462F6C32.5010604@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: heikki@enterprisedb.com, j_mageshwaran@sifycorp.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Kill a Long Running Query
  In-Reply-To: <462F6C32.5010604@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox