HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Increasing WAL Segment Size?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
segmentwalsizeincreasing

Problem

Is it possible to increase the WAL segment size in an existing PostgreSQL 11 database? What are the disadvantages of having larger WAL segment sizes?

The reason for wanting to increase it from 16 MB is to increase the speed of transferring WAL backups when using WAL-E. 16 MB WAL files were transferring at a speed of about 20 MB/s (using SSDs in striped mirrored pairs) which is really slow for database sizes larger than 1 TB.

After increasing the WAL segment size, do we typically want to change the values for min_wal_size and max_wal_size?

Solution

You can choose a WAL segment size with initdb when you create a new cluster. So you would have to dump and restore the data, which means down time. Jeff Janes' answer explains that this can also be done with pg_resetwal.

The only disadvantage of a larger WAL segment size I can think of is that the amount of WAL you lose when the file system with pg_wal on it is lost will increase. But that is a small problem and can be worked around with pg_receivewal.

I cannot think of a reason to change max_wal_size or min_wal_size because of a different WAL segment size, but perhaps a value of wal_buffers that matches the segment size would be beneficial.

Context

StackExchange Database Administrators Q#264505, answer score: 2

Revisions (0)

No revisions yet.