Chris Cawley <cj_cawley@yahoo.com> writes:
> Here's the query :
> | SELECT pid, age(clock_timestamp(), query_start), usename, query |
> | | FROM pg_stat_activity |
> | | WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
> | | ORDER BY query_start desc; |
> Return output is pid | 4 days | user | ROLLBACK
I think the fault's in your query; it's presuming a long-obsolete
convention about how idle sessions are represented in pg_stat_activity.
These days you should be filtering on "state" or "wait_event_type".
This output is just telling you that the last thing that session
did, four days ago, was a ROLLBACK.
regards, tom lane