Sometimes the only way to let the system as a whole continue is by terminating some offending database sessions.
Again, this is a superuser-only capability, so log in as a superuser.
Once you have figured out the backend you need to kill, use the function named
pg_terminate_backend(processid) to actually kill it.
When a backend executes the
pg_terminate_backend(processid) function, it sends a signal SIGQUIT to the backend given as an argument, after checking that the process identified by the argument
processid actually is a PostgreSQL backend.
The backend receiving this signal stops whatever it is doing, and terminates it in a controlled way.
The client using that backend loses ...