Chris Kratz <chris(dot)kratz(at)vistashare(dot)com> writes:
> ... Or if worse comes to worse to actually kill long running
> processes without taking down the whole db as we have had to do on occasion.
A quick "kill -INT" suffices to issue a query cancel, which I think is
what you want here. You could also consider putting an upper limit on
how long things can run by means of statement_timeout.
Those are just band-aids though. Not sure about the underlying problem.
Ordinarily I'd guess that the big-hog queries are causing trouble by
evicting everything the other queries need from cache. But since your
database fits in RAM, that doesn't seem to hold water.
What PG version are you running?
regards, tom lane