POSTGRESQL-ESSENTIALS practice question 11 of 15

In PostgreSQL, what is the default size of a WAL segment file?

Full set: 71 questions
Answer options
A: 8 MB
B: 16 MB Correct answer
C: 32 MB
D: 64 MB
Correct Answer:
B. 16 MB
Explanation

PostgreSQL's Write-Ahead Log (WAL) is a standard method for ensuring data integrity. The log is divided into a series of individual files called WAL segments. By default, the size of each WAL segment file is 16 megabytes (MB). This size is determined during the initialization of the database cluster with the initdb command and cannot be altered for an existing cluster. The default value of 16 MB provides a balance between the overhead of file management and the granularity of log archiving.

Why Incorrect

A. 8 MB: This is not the standard default size for WAL segment files in PostgreSQL.
C. 32 MB: While this is a valid size that can be configured during initialization, it is not the default.
D. 64 MB: This is a valid, but not default, size for a WAL segment file.

References

1. PostgreSQL 16 Official Documentation, Chapter 30. Write-Ahead Logging, Section 30.4. WAL Configuration: "The WAL log is divided into a series of files called segments. Each segment is normally 16 MB in size (though the size can be altered during initdb)."

2. PostgreSQL 16 Official Documentation, Server Applications, initdb: Under the "Options" section, the --wal-segsize=size parameter is described: "Set the WAL segment size, in megabytes. This is the size of each individual file in the WAL log. The default is 16 megabytes."

3. PostgreSQL 16 Official Documentation, Chapter 20. Server Configuration, Section 20.4. Write Ahead Log: "The default WAL segment size is 16 MB."

4. University of California, Berkeley, CS 186/286, Introduction to Database Systems, Lecture 12: Crash Recovery: The lecture notes discuss the implementation of Write-Ahead Logging, and while they may not specify the default size for PostgreSQL, they explain the concept of log segmentation which is fundamental to the question. The default size is a specific implementation detail found in the official vendor documentation. (Note: University courseware explains the concept, while the official documentation provides the specific value).

Scroll to Top