Re: Significance of queries listed under server activity items

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Adam Manwaring <pantsmann(at)byu(dot)net>
Cc: pgadmin-support(at)lists(dot)postgresql(dot)org
Subject: Re: Significance of queries listed under server activity items
Date: 2017-10-19 08:19:02
Message-ID: CA+OCxoywjgaXaGu1p=DXacDX2iCAYyOt-nEJ7qUOiaJ6X4x6MA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi

On Wed, Oct 18, 2017 at 6:25 PM, Adam Manwaring <pantsmann(at)byu(dot)net> wrote:

> When viewing the details on a row on the "Server Activity" table an
> sql query is listed along with a few timestamps. I've been assuming that
> the query shown is the last active query for that session. What I don't
> know is whether it is the last one committed or the last one begun. I've
> had some trouble with sessions stuck in "idle in transaction" status. I
> need to know if the query is the query that has not been committed or if it
> is the previous query (committed prior to one that is stuck).
>
> I can't seem to find anything that says specifically what this query is,
> so I don't know whether I should be looking at the query shown to figure
> out what is going wrong or if I need to look elsewhere.
>

The data shown there almost all comes from the pg_stat_activity view. In PG
10, the query field is described as:

Text of this backend's most recent query. If state is active this field
shows the currently executing query. In all other states, it shows the last
query that was executed. By default the query text is truncated at 1024
characters; this value can be changed via the parameter
track_activity_query_size
<https://www.postgresql.org/docs/10/static/runtime-config-statistics.html#guc-track-activity-query-size>
.

https://www.postgresql.org/docs/10/static/monitoring-stats.html#monitoring-stats-dynamic-views-table

In earlier versions, iirc the size wasn't limited.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Rob Emery 2017-10-19 08:51:05 PGAgent Connection Pool Leaking
Previous Message Adam Manwaring 2017-10-18 17:25:29 Significance of queries listed under server activity items