Re: [HACKERS] pg_stat_activity.waiting_start

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] pg_stat_activity.waiting_start
Дата
Msg-id 14146.1482784599@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] pg_stat_activity.waiting_start  (Joel Jacobson <joel@trustly.com>)
Ответы Re: [HACKERS] pg_stat_activity.waiting_start  (Stephen Frost <sfrost@snowman.net>)
Re: [HACKERS] pg_stat_activity.waiting_start  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Joel Jacobson <joel@trustly.com> writes:
> Maybe a good tradeoff then would be to let "wait_start" represent the
> very first time the txn started waiting?
> ...
> As long as the documentation is clear on "wait_start" meaning when the
> first wait started in the txn, I think that's useful enough to improve
> the situation, as one could then ask a query like "select all
> processes that have possibly been waiting for at least 5 seconds",
> which you cannot do today.

Meh.  You *can* do that now: query pg_stat_activity for waiting processes,
wait a couple seconds, query again, intersect the results.  I think really
the only useful improvement on that would be to be able to tell that the
process has been blocked continuously for X seconds, and what you're
proposing here won't do that.

In practice, there should never be waits on LWLocks (much less spinlocks)
that exceed order-of-milliseconds; if there are, either we chose the wrong
lock type or the system is pretty broken in general.  So maybe it's
sufficient if we provide a wait start time for heavyweight locks ...
though that still seems kind of ugly.  (Also, I don't recall the existing
code factorization there, but getting the start time into pg_stat_activity
without an extra gettimeofday call might be hard.  As I said, there is
one being done, but I'm not sure how accessible its result is.)

I did a bit more research over the weekend into the cost of gettimeofday
and clock_gettime, and have some new results that I'll post into that
thread shortly.  But the short answer is still "they're damn expensive
on some platforms, and not really cheap anywhere".
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Incautious handling of overlength identifiers
Следующее
От: Artur Zakirov
Дата:
Сообщение: Re: [HACKERS] [PATCH] Generic type subscription