Postgres starts separate process for each connection and you can just `kill`(not `kill -9`) the unwanted process. Or you can do `selectpg_cancel_backend(pid)` from another session.