Re: What do you do with a long running rollback

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Cawley <cj_cawley(at)yahoo(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: What do you do with a long running rollback
Date: 2021-11-26 19:44:29
Message-ID: 444716.1637955869@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Chris Cawley <cj_cawley(at)yahoo(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message SQL Padawan 2021-11-27 17:01:34 Re: Postgres-XL
Previous Message Tom Lane 2021-11-26 18:42:16 Re: What do you do with a long running rollback

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2021-11-26 19:44:36 Re: Merge into does not work
Previous Message Ron 2021-11-26 19:41:03 Re: Merge into does not work