Re: WAL segments held for replcation

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Prince Pathria <prince(dot)pathria(at)goevive(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: WAL segments held for replcation
Date: 2018-09-24 06:19:53
Message-ID: 9ac4d6c25de72e681c40c4c60b64f0ad927b8689.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Prince Pathria wrote:

> I have following config
> wal_buffers = 16MB
> min_wal_size = 1GB
> max_wal_size = 2GB
> synchronous_commit = on
> archive_mode = on
> archive_command = 'cp %p /opt/postgres/%f'
> max_wal_senders = 4
> wal_keep_segments = 1024
> synchronous_standby_names = 'pgslave01'
>
>
> 1. Can we raise wal segment size to more than 16MB and is it same
> as `wal_buffers` ?

You can, but only by recompiling PostgreSQL.

Don't do it.

"wal_buffers" is not directly related to the size of the WAL segment.

> 2. During data loading I'm pushing 4GB data, and taking an assumption
> that my network is slow,
> Will master keep the segments in pg_wal more than wal_keep_segment value
> such that it's pulled by standby nodes or it will wipe if off?

No, it will happily delete them as soon as "wal_keep_segments" is exceeded.

Using replication slots is the best way to avoid that.

> 3. 1024 wal_keep_segments of 16 mb each makes 16GB of segments kept but
> I have kept max_wal_size = 2GB. Which one will be prioritised max_wal_size
> or wal_keep_segment?

"max_wal_size" is a soft limit, so if "wal_keep_segments" is set higher,
PostgreSQL will retain more than "max_wal_size" WAL.

Yours,
Laurenz Albe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2018-09-24 06:22:04 Re: Archive clean up command in recovery.conf
Previous Message Aldo Sarmiento 2018-09-23 15:53:26 New replica with pgbackrest