Re: IDLE in transaction introspection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Marti Raudsepp <marti(at)juffo(dot)org>, Scott Mead <scottm(at)openscg(dot)com>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "Andrew Dunstan *EXTERN*" <andrew(at)dunslane(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IDLE in transaction introspection
Date: 2011-11-04 14:34:46
Message-ID: 7128.1320417286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> I guess with the changes that showed different thing like fastpath,
> that makes sense. But if we just mapped the states that are there
> today straight off, is there any case where waiting can be true, when
> we're either idle or idle in transaction? I think not..

I'm not totally sure about that. I know that it's possible to see "idle
waiting" in the ps display, but that comes from getting blocked in parse
analysis before the command type has been determined. The
pg_stat_activity string is set a bit earlier, so *maybe* it's impossible
there. Still, why wire such an assumption into the structure of the
view? Robert's point about sinval catchup is another good one, though
I don't remember what that does to the pg_stat_activity display.

BTW, a quick grep shows that there are four not two special values of
the activity string today:

src/backend/tcop/postgres.c: 3792: pgstat_report_activity("<IDLE> in transaction (aborted)");
src/backend/tcop/postgres.c: 3797: pgstat_report_activity("<IDLE> in transaction");
src/backend/tcop/postgres.c: 3805: pgstat_report_activity("<IDLE>");
src/backend/tcop/postgres.c: 3925: pgstat_report_activity("<FASTPATH> function call");

It's also worth considering whether the "autovacuum:" that's prepended
by autovac_report_activity() ought to be folded into the state instead
of continuing to put something that's not valid SQL into the query
string.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2011-11-04 14:37:50 Re: Show sequences owned by
Previous Message Stephen Frost 2011-11-04 14:29:36 Re: Show sequences owned by