Re: [HACKERS] Kill a Long Running Query

2007-04-25 Thread Heikki Linnakangas
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

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [HACKERS] Kill a Long Running Query

2007-04-25 Thread Andrew Dunstan

Mageshwaran wrote:

Hi ,
Any body tell me how to kill a long running query in postgresql, is 
there any statement to kill a query, and also tell me how to log slow 
queries to a log file.





First. please do not cross-post like this. Pick the correct list and use it.

Second, this query definitely does not belong on the -hackers list.

Third, please find a way of posting to lists that does not include a 
huge disclaimer and advertisements. If that is added by your company's 
mail server, you should look at using some other method of posting such 
as gmail.


Fourth, please read our excellent documentation. It contains the answers 
to your questions, I believe.


cheers

andrew

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq