Re: New statistics for tuning WAL buffer size

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: tsunakawa(dot)takay(at)fujitsu(dot)com
Subject: Re: New statistics for tuning WAL buffer size
Date: 2020-09-01 09:57:12
Message-ID: 7b648985-9361-8425-7e8f-30a6404b2281@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020/08/24 21:00, Masahiro Ikeda wrote:
> On 2020-08-24 20:45, Masahiro Ikeda wrote:
>> Hi, thanks for useful comments.
>>
>>>> I agree to expose the number of WAL write caused by full of WAL buffers.
>>>> It's helpful when tuning wal_buffers size. Haribabu separated that number
>>>> into two fields in his patch; one is the number of WAL write by backend,
>>>> and another is by background processes and workers. But I'm not sure
>>>> how useful such separation is. I'm ok with just one field for that number.
>>> I agree with you.  I don't think we need to separate the numbers for foreground processes and background ones.  WAL buffer is a single resource.  So "Writes due to full WAL buffer are happening.  We may be able to boost performance by increasing wal_buffers" would be enough.
>>
>> I made a patch to expose the number of WAL write caused by full of WAL buffers.
>> I'm going to submit this patch to commitfests.
>>
>> As Fujii-san and Tsunakawa-san said, it expose the total number
>> since I agreed that we don't need to separate the numbers for
>> foreground processes and background ones.
>>
>> By the way, do we need to add another metrics related to WAL?
>> For example, is the total number of WAL writes to the buffers useful
>> to calculate the dirty WAL write ratio?
>>
>> Is it enough as a first step?
>
> I forgot to rebase the current master.
> I've attached the rebased patch.

Thanks for the patch!

+/* ----------
+ * Backend types
+ * ----------

You seem to forget to add "*/" into the above comment.
This issue could cause the following compiler warning.

../../src/include/pgstat.h:761:1: warning: '/*' within block comment [-Wcomment]

The contents of pg_stat_walwrites are reset when the server
is restarted. Isn't this problematic? IMO since pg_stat_walwrites
is a collected statistics view, basically its contents should be
kept even in the case of server restart.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junfeng Yang 2020-09-01 10:03:35 回复: 回复: Is it possible to set end-of-data marker for COPY statement.
Previous Message Daniel Gustafsson 2020-09-01 09:53:36 Re: Switch to multi-inserts for pg_depend