I wanted to understand how the WAL file internally looks -like is the below sequence one is correct.
Transaction required->WAL logfile->WAL records->WAL segments ( each segements divided of 16MB size say ex)-> each segments have Pages(8KB)
Also I would like to know that can some one give Me internal WAL file- how it looks in an easy way and correct Me If Iam wrong..as Iam new to learn here so.
2
Answers
WAL is split in segments (= files).
Each WAL segment contains WAL records. There are no blocks; WAL is written sequentially.
Wal files are present in /PGData/pg_wal/ directory.If your interested to see the contents of wal file use pg_waldump utility.
For Example:-
/bin/pg_waldump -p <path_to_pg_wal_directory> 000000010000000000000042
Here
000000010000000000000042 is the name of WAL segment you want to explore.
EDIT:-
Each WAL segment(default 16 MB size) is divided into pages which is of 8kb(default) size,each page will have WAL records.
Each WAL record will basically have three things.
1.Type of record
2.Transaction id
3.LSN associated with it.