Query on pg_stat_activity table got stuck

From: neeraj kumar <neeru(dot)cse(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Query on pg_stat_activity table got stuck
Date: 2019-05-06 18:24:31
Message-ID: CAPR3Wj5Z17=+eeyrn_ZDG3NQGYgMEOY6JV6Y-WRRhGgwc16U3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hello,

We are using PG 10.6. We have one cron job that queries pg_stat_activity
table to find out how many queries are running longer than X minutes and
generate metrics.

Query look like this :
SELECT * FROM pg_stat_activity WHERE state='active'

After some days, this query get stuck and doesn't finish. We tried to run
this query manually and same result.

We looked into pg_locks table and there this query is not blocked on any
lock :
https://justpaste.it/48rpe

Now we don't know where to look next. Our expectation was query on
pg_stat_activity shouldn't get blocked on anything and pg_locks also
showing same result.
Google search also not returning anything useful that is why reaching out
to this email list.
We have separated that DB and issue is still produceable on that DB, in
case if more information is not needed.

-------------------------------------
Thanks
Neeraj

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Pavan Kumar 2019-05-06 19:25:57 postgres wal log configuration question
Previous Message Andres Freund 2019-05-06 14:39:12 Re: Restoring from PostgreSQL 9.5 dump to 10 is super slow

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2019-05-06 19:11:36 Re: Upgrading locale issues
Previous Message Michel Pelletier 2019-05-06 15:49:42 Re: Looking for feedback and contributions