postgresqlwalapache-age

Why does PostgreSQL need both WAL buffer and WAL segment file?


I'm trying to understand more about the apacheAGE extension therefore I'm reading the inner workings of PostgreSQL. From what I understand every operation that alters the table is written at the WAL buffer, but after it is commited/aborted it is immediately written to the WAL segment file on the storage.

Why is the first part needed? Isn't having 2 steps more time-consuming, since the WAL segment file is enough by itself to recover from a server crash?


Solution

  • WAL buffers is just a cache for WAL; eventually the data are written to the WAL segment files. Like with all caches, the goal is to boost performance.