Re: New statistics for tuning WAL buffer size

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: masao(dot)fujii(at)oss(dot)nttdata(dot)com
Cc: amit(dot)kapila16(at)gmail(dot)com, ikedamsh(at)oss(dot)nttdata(dot)com, pgsql-hackers(at)postgresql(dot)org, tsunakawa(dot)takay(at)fujitsu(dot)com, magnus(at)hagander(dot)net
Subject: Re: New statistics for tuning WAL buffer size
Date: 2020-10-01 01:23:50
Message-ID: 20201001.102350.2079532890439878088.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 1 Oct 2020 09:05:19 +0900, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote in
>
>
> On 2020/09/30 20:21, Amit Kapila wrote:
> > On Tue, Sep 29, 2020 at 9:23 PM Fujii Masao
> > <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
> >>
> >> On 2020/09/29 11:51, Masahiro Ikeda wrote:
> >>> On 2020-09-29 11:43, Amit Kapila wrote:
> >>>> On Tue, Sep 29, 2020 at 7:39 AM Masahiro Ikeda
> >>>> <ikedamsh(at)oss(dot)nttdata(dot)com> wrote:
> >>> Thanks for your suggestion.
> >>> I understood that the point is that WAL-related stats have just one
> >>> counter now.
> >>>
> >>> Since we may add some WAL-related stats like pgWalUsage.(bytes,
> >>> records, fpi),
> >>> I think that the current approach is good.
> >>
> >> +1
> >>
> > Okay, it makes sense to keep it in the current form if we have a plan
> > to extend this view with additional stats. However, why don't we
> > expose it with a function similar to pg_stat_get_archiver() instead of
> > providing individual functions like pg_stat_get_wal_buffers_full() and
> > pg_stat_get_wal_stat_reset_time?
>
> We can adopt either of those approaches for pg_stat_wal. I think that
> the former is a bit more flexible because we can collect only one of
> WAL information even when pg_stat_wal will contain many information
> in the future, by using the function. But you thought there are some
> reasons that the latter is better for pg_stat_wal?

FWIW I prefer to expose it by one SRF function rather than by
subdivided functions. One of the reasons is the less oid consumption
and/or reduction of definitions for intrinsic functions.

Another reason is at least for me subdivided functions are not useful
so much for on-the-fly examination on psql console. I'm often annoyed
by realizing I can't recall the exact name of a function, say,
pg_last_wal_receive_lsn or such but function names cannot be
auto-completed on psql console. "select proname from pg_proc where
proname like.. " is one of my friends:p On the other hand "select *
from pg_stat_wal" requires no detailed memory.

However subdivided functions might be useful if I wanted use just one
number of wal-stats in a function, I think it is not a major usage and
we can use a SQL query on the view instead.

Another reason that I mildly want to object to subdivided functions is
I was annoyed that a stats view makes many individual calls to
functions that internally share the same statistics entry. That
behavior required me to provide an entry-caching feature to my
shared-memory statistics patch.

regrds.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-10-01 01:40:44 Re: __pg_log_level in anonynous enum should be initialized? (Was: pgsql: Change SHA2 implementation based on OpenSSL to use EVP digest ro)
Previous Message Fujii Masao 2020-10-01 01:01:56 Re: Disable WAL logging to speed up data loading