In PostgreSQL, the WAL can usually be found in the pg_wal directory in the data directory, unless specified otherwise on initdb. In older versions of PostgreSQL, the WAL directory was called pg_xlog, but with the introduction of PostgreSQL 10.0, the directory has been renamed.
The reason for this is that more often than not, people would delete the content of the pg_xlog directory, which of course led to serious issues and potential database corruption. The community has therefore taken the unprecedented step of renaming a directory inside a PostgreSQL instance. The hope is to make the name scary enough that nobody dares to delete the content again.
The following listing shows what the pg_wal directory looks as follows:
[postgres@zenbook pg_wal]$ pwd
/var/lib/pgsql/11/data/pg_wal
[postgres@zenbook pg_wal]$ ls -l
total 688132
-rw-------. 1 postgres postgres 16777216 Jan 19 07:58 0000000100000000000000CD
-rw-------. 1 postgres postgres 16777216 Jan 13 17:04 0000000100000000000000CE
-rw-------. 1 postgres postgres 16777216 Jan 13 17:04 0000000100000000000000CF
-rw-------. 1 postgres postgres 16777216 Jan 13 17:04 0000000100000000000000D0
-rw-------. 1 postgres postgres 16777216 Jan 13 17:04 0000000100000000000000D1
-rw-------. 1 postgres postgres 16777216 Jan 13 17:04 0000000100000000000000D2
What we can see is that the transaction log is a 16 MB file that consists of 24 digits. The numbering is hexadecimal. As we can see, CF is followed by D0. The files are always a fixed size.
Traditionally, the WAL typically consists of 16 MB files. However, since the introduction of PostgreSQL, the size of a WAL segment can now be set at initdb. In some cases, this can speed things up. Here is how it works. The following example shows us how the WAL file size can be changed to 32 MB:
initdb -D /pgdata --wal-segsize=32