0

The connections were created 2 days before. Can I kill the process manually by using the below query?

select pg_terminate_backend(procpid)
from pg_stat_activity
where datname = 'mydb'
and procpid <> pg_backend_pid()
and current_query = '<IDLE>'
and query_start < now() - INTERVAL '2880' MINUTE;
Erwin Brandstetter
186k28 gold badges463 silver badges636 bronze badges
asked Aug 1, 2014 at 11:28

1 Answer 1

1

The answer is: "Yes, sure you can." But I doubt you wanted to ask that.

Obviously, you need to make sure you only kill processes that need killing. If possible, it's best done with the same role as the targeted processes to avoid collateral damage - only superusers can terminate processes of other roles.

Related:

answered Aug 21, 2014 at 22:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.