Re: Query stucked in pg_stat_activity - Mailing list pgsql-general

From Tom Lane
Subject Re: Query stucked in pg_stat_activity
Date
Msg-id 16374.1123601063@sss.pgh.pa.us
Whole thread Raw
In response to Query stucked in pg_stat_activity  (Csaba Nagy <nagy@ecircle-ag.com>)
List pgsql-general
Csaba Nagy <nagy@ecircle-ag.com> writes:
> On our first test run everything went fine, the only strange thing is a
> row in the pg_stat_activity, which has a row about a query which is long
> gone, the process pointed by the procpid field is not existing.

This is not totally surprising, since the pgstat mechanism is by design
not 100% reliable (it will drop statistics messages under high load
rather than making backends wait for the stats collector).  Probably the
backend-is-exiting message for that process got dropped.

Eventually that backend slot will get re-used for another backend, and
then the entry will go away, but if it's a high-number slot then it'll
take a similar load level to get to it.

> I've executed a "select pg_stat_reset();" as superuser, and all went
> away except the offending row...

That only resets the I/O counts (and only for one database), not the
backend activity info.

            regards, tom lane

pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: Query stucked in pg_stat_activity
Next
From: Tom Lane
Date:
Subject: Re: Referencing "less-unique" foreign keys