Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Kill a Long Running Query

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Mageshwaran <j_mageshwaran(at)sifycorp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org, Postgres <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Kill a Long Running Query
Date: 2007-04-25 14:56:50
Message-ID: 462F6C32.5010604@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-generalpgsql-hackers
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

In response to

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2007-04-25 14:56:51
Subject: Re: [HACKERS] Kill a Long Running Query
Previous:From: Aaron BonoDate: 2007-04-25 14:53:50
Subject: Re: Kill a Long Running Query

pgsql-admin by date

Next:From: Andrew DunstanDate: 2007-04-25 14:56:51
Subject: Re: [HACKERS] Kill a Long Running Query
Previous:From: Aaron BonoDate: 2007-04-25 14:53:50
Subject: Re: Kill a Long Running Query

pgsql-general by date

Next:From: Andrew DunstanDate: 2007-04-25 14:56:51
Subject: Re: [HACKERS] Kill a Long Running Query
Previous:From: Richard HuxtonDate: 2007-04-25 14:56:45
Subject: Re: pg_connect sometimes works sometimes not

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group