Re: RFC: replace pg_stat_activity.waiting with something more descriptive

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: neha khatri <nehakhatri5(at)gmail(dot)com>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Vladimir Borodin <root(at)simply(dot)name>, Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Date: 2016-08-26 02:25:22
Message-ID: CAA4eK1+AyjM6vj4TAFPrQpss9LzwPakUjnXEQq6wArsRsdJkqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 26, 2016 at 4:59 AM, neha khatri <nehakhatri5(at)gmail(dot)com> wrote:

> Hello,
>
> I noticed that a small optimization is possible in the flow of wait stat
> reporting for the LWLocks, when the pgstat_track_activities is disabled.
> If the check for pgstat_track_activities is done before invoking
> LWLockReportWaitStart() instead of inside the pgstat_report_wait_start(),
> it can save some of the statements execution where the end result of
> LWLockReportWaitStart() is a NO-OP because pgstat_track_activities = false.
>
>
This is only called in slow path which means when we have to wait or sleep,
so saving few instructions will not make much difference. Note that both
the functions you have mentioned are inline functions. However, If you
want, you can try that way and see if this leads to any gain.

> I also see, that there are other callers of pgstat_report_wait_start() as
> well, which would also have to change to add a check for the
> pg_stat_activities, if the check is removed from the
> pgstat_report_wait_start(). Is the pg_stat_activities check inside
> pgstat_report_wait_start() because of some protocol being followed?
>

Not as such, but that variable is mainly used in pgstat.c/.h only.

> Would it be worth making that change.
>
>
-1 for the proposed change.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-08-26 02:30:08 Re: patch proposal
Previous Message Venkata B Nagothi 2016-08-26 02:14:25 Re: patch proposal