I am trying to understand the implementation of WAL in Postgres 9.3.5. In xlog.c file, there is a parameter XLOG_SWITCH which I don't understand. I googled this parameter, but I didn't find useful information. Could anyone explain the purpose of this parameter?
1 Answer
Changes in the database are stored in xlog files that are for default 16MB size, principally for crash recovery, or a hot standby server, that means the server must full a file with commands like create table, insert into, etc. They‘re reasons to switch the log before that 16MB gets full, like you don‘t want to wait to migrate the current xlog for a standby server, and they‘re reasons too to expand that size, and it‘s because you consider that 16MB is little bit and the transactions in your database generate so much xlog files, the size to switch the xlogs depends of the amount of data that you‘re willing to lose