Thread: Terminating a query that appears to be hung

Terminating a query that appears to be hung

From
Robert D Oden
Date:
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@dbasetek.com


Re: Terminating a query that appears to be hung

From
"Phillip Smith"
Date:
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@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
Sent: Tuesday, 30 January 2007 2:03 AM
To: PgSQL ADMIN
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@dbasetek.com


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate


*******************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

Re: Terminating a query that appears to be hung

From
"Guido Barosio"
Date:
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.smith@weatherbeeta.com.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@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
> Sent: Tuesday, 30 January 2007 2:03 AM
> To: PgSQL ADMIN
> 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@dbasetek.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
>                 http://www.postgresql.org/about/donate
>
>
> *******************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
-----------------------
http://www.globant.com
guido.barosio@globant.com

Re: Terminating a query that appears to be hung

From
"Eduardo J. Ortega"
Date:
You can also kill the postgres process corresponding to the hung query. do NOT
kill -9. Only kill. Postgres will rollback any uncomitted transaction and
finish that connection gracefully.

On Monday 29 January 2007 18:35, Phillip Smith 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@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
> Sent: Tuesday, 30 January 2007 2:03 AM
> To: PgSQL ADMIN
> 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

--
Eduardo J. Ortega - Linux user #222873
"No fake - I'm a big fan of konqueror, and I use it for everything." -- Linus
Torvalds

Re: Terminating a query that appears to be hung

From
"codeWarrior"
Date:
and from the shell prompt: you can find ALL postgreSQL process id's by:

%>ps ax | grep postgres





""Eduardo J. Ortega"" <ejortegau@cable.net.co> wrote in message
news:200701292233.36805.ejortegau@cable.net.co...
> You can also kill the postgres process corresponding to the hung query. do
> NOT
> kill -9. Only kill. Postgres will rollback any uncomitted transaction and
> finish that connection gracefully.
>
> On Monday 29 January 2007 18:35, Phillip Smith 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@postgresql.org
>> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
>> Sent: Tuesday, 30 January 2007 2:03 AM
>> To: PgSQL ADMIN
>> 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
>
> --
> Eduardo J. Ortega - Linux user #222873
> "No fake - I'm a big fan of konqueror, and I use it for everything." --
> Linus
> Torvalds
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>



Re: Terminating a query that appears to be hung

From
Robert D Oden
Date:
Thank you for the response. We are using Linux and I am able to identify
the offending <pid>. I was not sure if killing the process was an
acceptable and safe practice.

Thanks again!
Robert

Guido Barosio wrote:
> 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.smith@weatherbeeta.com.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@postgresql.org
>> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
>> Sent: Tuesday, 30 January 2007 2:03 AM
>> To: PgSQL ADMIN
>> 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@dbasetek.com
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 7: You can help support the PostgreSQL project by donating at
>>
>>                 http://www.postgresql.org/about/donate
>>
>>
>> *******************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
>>
>
>

--

Robert D Oden
Database Marketing Technologies, Inc
951 Locust Hill Circle
Belton MO 64012-1786

Ph:  816-318-8840
Fax: 816-318-8841

roden@dbasetek.com


Re: Terminating a query that appears to be hung

From
"Shoaib Mir"
Date:
Use SIGTERM for killing only one process. You can also use kill -INT. It sends a query cancel to the backend and will not disturb other processes and the database server.

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 2/3/07, Robert D Oden < roden@dbasetek.com> wrote:
Thank you for the response. We are using Linux and I am able to identify
the offending <pid>. I was not sure if killing the process was an
acceptable and safe practice.

Thanks again!
Robert

Guido Barosio wrote:
> 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.smith@weatherbeeta.com.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@postgresql.org
>> [mailto: pgsql-admin-owner@postgresql.org] On Behalf Of Robert D Oden
>> Sent: Tuesday, 30 January 2007 2:03 AM
>> To: PgSQL ADMIN
>> 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@dbasetek.com
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 7: You can help support the PostgreSQL project by donating at
>>
>>                 http://www.postgresql.org/about/donate
>>
>>
>> *******************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
>>
>
>

--

Robert D Oden
Database Marketing Technologies, Inc
951 Locust Hill Circle
Belton MO 64012-1786

Ph:  816-318-8840
Fax: 816-318-8841

roden@dbasetek.com


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match