Postgres-9.1 having more Idle connections
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:


How do I detach all other users from a postgres database?