Re: IDLE in transaction introspection

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

Scott Mead wrote:
> On Wed, Nov 2, 2011 at 4:12 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>wrote:
>
> > Andrew Dunstan wrote:
> > > On 11/01/2011 09:52 AM, Tom Lane wrote:
> > >> I'm for just redefining the query field as "current or last
> > >> query".
> > >
> > > +1
> > >
> > >> I could go either way on whether to rename it.
> > >
> > > Rename it please. "current_query" will just be wrong. I'd be inclined
> > > just to call it "query" or "query_string" and leave it to the docs to
> > > define the exact semantics.
> >
> > +1 for renaming, +1 for a state column.
> > I think it is overkill to keep a query history beyond that -- if you
> > want that,
> > you can resort to the log files.
> >
> >
> ISTM that we're all for:
>
> creating a new column: state
> renaming current_query => query
>
> State will display <RUNNING>, <IDLE>, <IDLE> in transaction, etc...
> query will display the last query that was executed.
>
> I've written this up in the attached patch, looking for feedback. (NB:
> Originally I was using 9.1.1 release, I just did a git clone today to
> generate this).

It might be cleaner to use booleans:

active: t/f
in transaction: t/f

or maybe instead of 'active':

idle: t/f
in transaction: t/f

That avoids the magic string values for the state column. Those are
much easier to query against too:

WHERE NOT idle;

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-10 18:55:59 Re: IDLE in transaction introspection
Previous Message Scott Mead 2011-11-10 18:26:37 Re: IDLE in transaction introspection