Identify the session that you would like to terminate from the below view and copy the process id.
SELECT * FROM STV_SESSIONS;
Kill the session as below where pid is the process id of the user session that you would like to terminate.
SELECT pg_terminate_backend(pid);
Output ‘1’ indicates the session has been terminated successfully.
Kill all the sessions of a particular user as below:
SELECT pg_terminate_backend(process) FROM STV_SESSIONS where user_name='username' and process != pg_backend_pid();