Monitor running queries

View a list of running queries:

SELECT
  datname,
  pid,
  usename,
  client_addr,
  client_port,
  xact_start,
  backend_start,
  query_start,
  state,
  query
FROM pg_stat_activity
ORDER BY query_start ASC

View list of non-idle connections:

SELECT
  datname,
  pid,
  usename,
  client_addr,
  client_port,
  xact_start,
  backend_start,
  query_start
FROM pg_stat_activity
WHERE
  state != 'idle'
ORDER BY query_start ASC
Sources: techmango.org