How to view the sql history(recent queries) of a user in Redshift

Use the below sql statement to view the recent 100 queries run by a user ordered by the most recent query on top where ‘nameoftheuser’ is the username.

select * from svl_qlog
where userid = (select usesysid from pg_user where usename='nameoftheuser')
order by starttime desc
limit 100;

See also  How to grant super user privileges to a Redshift database user