yb_terminate_session

Terminate the specified user session.
yb_terminate_session(session_id)

This function returns t (success), f (failure), or NULL (unknown session ID). You can get session IDs from the sys.session view. For example:

yellowbrick=# select * from sys.session where application_name='ybsql';
 session_id | application_name | client_hostname | client_ip_address | database_id | user_id |          start_time           | process_id 
------------+------------------+-----------------+-------------------+-------------+---------+-------------------------------+------------
      18120 | ybsql            | [NULL]          | [NULL]            |        4400 |      10 | 2018-06-04 13:14:16.212301-07 |      30186
      18126 | ybsql            | [NULL]          | [NULL]            |       16388 |   16399 | 2018-06-04 13:17:21.43458-07  |      30854
(2 rows)

yellowbrick=# select yb_terminate_session(18126);
 yb_terminate_session 
----------------------
 t
(1 row)
Note: If you try to terminate an internal system user session (or the current user session), the function returns NULL and does not terminate it.