Activity is stored in the pg_stat_activity
table:
SELECT * FROM pg_stat_activity
A more useful query:
SELECT
usename,
application_name,
client_addr,
state,
datname,
REGEXP_REPLACE(REGEXP_REPLACE(query, 'SET.*?;', 'SET...;', 'g'), '\s+', ' ', 'g')
FROM
pg_stat_activity