How to Find and Stop Running Queries on PostgreSQL
adamj.eu
adamj.eu
I keep a dashboard of running pids, and get alerts when any of them take more than N minutes (excepting autovacuum). Once every few months I have to psql into prod and cancel one.
But it’s also really great for providing a cheap historical snapshot of activity for historical investigations and course grained analysis.
There are potential dangers with going overboard in this like inadvertently asserting troublesome locks or leaking sensitive data, but fairly easy to avoid.
Yes, she does. It's called "taskkill"
Or if you're a GUI kind of guy and want a nice interface with plenty of options I recommend "Process Hacker" (https://processhacker.sourceforge.io/).
https://stefansundin.github.io/superf4/
It seems to use the win32 TerminateProcess() function, I've never seen it fail although apparently according to the doc it does need to wait for pending I/O.
ProcessHacker looks interesting, I used Sysinternals' Process Explorer for the longest time and this appears to be a fork of it?