Re: pg_stat_activity.query empty - Mailing list pgsql-general

From David G. Johnston
Subject Re: pg_stat_activity.query empty
Date
Msg-id CAKFQuwbGGMETbFKV7BwW95Hr0OK2HeWpdTA6m=KhpeEbugfSUg@mail.gmail.com
Whole thread Raw
In response to pg_stat_activity.query empty  (Robert Lichtenberger <r.lichtenberger@synedra.com>)
Responses Re: pg_stat_activity.query empty
List pgsql-general
On Tue, Apr 26, 2022 at 6:55 AM Robert Lichtenberger <r.lichtenberger@synedra.com> wrote:
When executing "SELECT * FROM pg_stat_activity" I get lots of rows that
have an empty "query" column.

According to [1] this column should contain the "Text of this backend's
most recent query", either a query that is currently running or the last
query that was executed.

So how comes that a lot of the rows in pg_stat_activity have an empty
"query"?


https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW


They've never executed a query.  Probably due to connection pooling opening connections for the pool but never needing to hand them out.

David J.

pgsql-general by date:

Previous
From: Robert Lichtenberger
Date:
Subject: pg_stat_activity.query empty
Next
From: Laurenz Albe
Date:
Subject: Re: pg_stat_activity.query empty