PostgreSQL: Long running query detection
I am writing this post as a note to myself. Every time I want to find slow running queries, I search and open this medium post. It is a well written short post which helps me every day. But I wanted to improve that query.
As mentioned these are pretty helpful too.
SELECT pg_cancel_backend(pid); SELECT pg_terminate_backend(pid);