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.