Thread: Is there a way to list runaway queries and kill them?
Is there a way to list runaway or long runninng queries and kill them? Frank ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
On Tue, Jan 17, 2006 at 09:38:37AM +0000, frank church wrote: > Is there a way to list runaway or long runninng queries and kill them? With the proper statistics collector settings you can see queries with the pg_stat_activity view. You can automatically kill long-lasting queries by setting the statement_timeout parameter (but beware of setting it globally -- you probably don't want to time out maintenance operations like VACUUM). In 8.0 and later you can cancel a query in another backend with pg_cancel_backend(). http://www.postgresql.org/docs/8.1/interactive/monitoring-stats.html http://www.postgresql.org/docs/8.1/interactive/runtime-config-client.html http://www.postgresql.org/docs/8.1/interactive/functions-admin.html (These links are for 8.1; use the documentation for whatever version you're running.) -- Michael Fuhr