Killing "stuck" queries and preventing queries from getting "stuck" - Mailing list pgsql-general

From Tim Uckun
Subject Killing "stuck" queries and preventing queries from getting "stuck"
Date
Msg-id AANLkTikfk-3tVf_NzwjLo4OS+vrcSsWXv4k7jhdoWOZ3@mail.gmail.com
Whole thread Raw
Responses Re: Killing "stuck" queries and preventing queries from getting "stuck"  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Killing "stuck" queries and preventing queries from getting "stuck"  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general
I have a situation where there are dozens of daemons hitting the same
postgres database.  They all run different types of queries but each
daemon runs the same set of queries over and over again.

Sometimes some queries get "stuck" in that they run for hours and
hours. They never stop running.  Killing the deamon does not stop the
query from running.

Once there are three of four of these "stuck" queries the database
slows down drastically.

Is there a way to tell postgres to stop any query that runs longer
than a specified amount of time? Say an hour?

Failing that what is a good strategy for detecting stuck queries and
killing them.

Thanks.

pgsql-general by date:

Previous
From: Tim Uckun
Date:
Subject: Re: Deleting orphaned records (not exists is very slow)
Next
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: Deleting orphaned records (not exists is very slow)