Re: pg_stat_activity.waiting_start

From: Andres Freund <andres(at)anarazel(dot)de>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Joel Jacobson <joel(at)trustly(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stat_activity.waiting_start
Date: 2017-01-06 15:54:12
Message-ID: 20170106155412.37g3gqp4ilawsw5h@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-01-06 10:43:32 -0500, Bruce Momjian wrote:
> On Thu, Jan 5, 2017 at 06:48:17PM -1000, Joel Jacobson wrote:
> > On Thu, Jan 5, 2017 at 4:59 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > > Agreed. No need in adding overhead for short-lived locks because the
> > > milli-second values are going to be meaningless to users. I would be
> > > happy if we could find some weasel value for non-heavyweight locks.
> >
> > To avoid a NULL value for waiting_start, and thanks to non-heavyweight
> > locks don't exceed order-of-milliseconds, I think it would be
> > acceptable to just return now() whenever something wants to know
> > waiting_start i.e. when something selects from pg_stat_activity.
> >
> > The exact value would only be within orders-of-milliseconds away from
> > now() anyway, so one can argue it's not that important, as long as the
> > documentation is clear on that point.
>
> I don't think now() is a good value as it doesn't indicate to the user
> which values are real measurements and which are not. NULL is probably
> the best. +/-infinity is odd too.

Yea. If one wants to make NULL into now() it's trivial enough with a
single coalesce().

Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-06 16:00:09 Re: Indirect indexes
Previous Message Bruce Momjian 2017-01-06 15:43:32 Re: pg_stat_activity.waiting_start