I'm looking at my pg_stat_activity and trying to figure out what is causing some of these processes. I'm using this query:
SELECT pid, wait_event, state_change, backend_start, xact_start, query_start, state_change - query_start, query from pg_stat_activity where datname= 'my_database' and state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled');
and what I see is the same PID which have been around for a while in the same query (COMMIT), but the query_start and state_change are updated and close to each other:
So can we close this thread because it's been around since 1 AM and the last query is always "COMMIT"? Or should we keep it open because the query_start keeps updating, and the state_change is basically keeping up with query_start?