kill pid postgres code example Example: psql kill pid select pg_terminate_backend(pid) from pg_stat_activity where pid = '18765';