Unix Technical Forum

Re: [HACKERS] Kill a Long Running Query

This is a discussion on Re: [HACKERS] Kill a Long Running Query within the pgsql Admins forums, part of the PostgreSQL category; --> Please don't cross-post to multiple mailing lists. And pgsql-hackers is not the correct list for basic usage questions. And ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 07:27 AM
Heikki Linnakangas
 
Posts: n/a
Default Re: [HACKERS] Kill a Long Running Query

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/i...ons-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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:40 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com