Processes

Currently-running queries

show full processlist;

Long-running queries

select *
  from information_schema.processlist
 where time > 300;

Oldest running queries

  select *
    from information_schema.processlist
order by time desc;

Idle queries

select *
  from information_schema.processlist
 where Command = 'Sleep';