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

Re: Terminating a query that appears to be hung

From: "Guido Barosio" <gbarosio(at)gmail(dot)com>
To: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
Cc: "Robert D Oden" <roden(at)dbasetek(dot)com>, "PgSQL ADMIN" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Terminating a query that appears to be hung
Date: 2007-01-30 01:10:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Hmm, if you are a sysadmin you may want to get the process id for the
query, running something like:

Select procpid,current_query
from pg_stat_activity
where datname="dbname";

If you are running Linux, you'll get the procpid (pid) for the
offending query and by sending "kill -15 <pid>" you are
killing/terminating the query.

No idea on how to proceed if your platform is Windows.

Best wishes,
Guido Barosio

On 1/29/07, Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au> wrote:
> Can youo be a bit more specific...? What client?
> Psql should terminate the connection when it exist. pgAdmin will close it
> when you exit the ap, or if you choose 'Disconnect' from the menu. In PHP
> you'll need to call pg_close function... Every 'client' will have a
> different method...
> -----Original Message-----
> From: pgsql-admin-owner(at)postgresql(dot)org
> [mailto:pgsql-admin-owner(at)postgresql(dot)org] On Behalf Of Robert D Oden
> Sent: Tuesday, 30 January 2007 2:03 AM
> Subject: [ADMIN] Terminating a query that appears to be hung
> Is there a way to terminate a client session without having to restart
> Postgres.
> Thanks
> --
> Robert D Oden
> Database Marketing Technologies, Inc
> 951 Locust Hill Circle
> Belton MO 64012-1786
> Ph:  816-318-8840
> Fax: 816-318-8841
> roden(at)dbasetek(dot)com
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
> *******************Confidentiality and Privilege Notice*******************
> The material contained in this message is privileged and confidential to
> the addressee.  If you are not the addressee indicated in this message or
> responsible for delivery of the message to such person, you may not copy
> or deliver this message to anyone, and you should destroy it and kindly
> notify the sender by reply email.
> Information in this message that does not relate to the official business
> of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
> Weatherbeeta, its employees, contractors or associates shall not be liable
> for direct, indirect or consequential loss arising from transmission of this
> message or any attachments
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

Guido Barosio

In response to


pgsql-admin by date

Next:From: Eduardo J. OrtegaDate: 2007-01-30 03:33:34
Subject: Re: Terminating a query that appears to be hung
Previous:From: Phillip SmithDate: 2007-01-29 23:35:41
Subject: Re: Terminating a query that appears to be hung

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