How to view all active sessions in Redshift database

Use the below query to view all active sessions in Redshift database.

select distinct starttime , process , user_name , remotehost , remoteport from stv_sessions s, stl_connection_log c where s.process=c.pid order by 1;
See also  How to execute a stored procedure in Redshift database