Re: RFC: WAL infrastructure issues, updates and improvements
Re: RFC: WAL infrastructure issues, updates and improvements
От:
Matthias van de Meent <boekewurm+postgres@gmail.com>
Дата:
Hi, Various users and threads on -hackers (incl. [0] specifically) have complained about the overhead of our WAL format. One example of this is that we write at least 44 bytes to register any changes to a single relation's page: There is a 24-byte WAL record header, a 4-byte block record header, plus 12 bytes for RelFileLocator, plus 4 bytes for BlockNumber. This is a very significant overhead, which is threatening to grow ever larger as we're considering moving to larger identifiers in PostgreSQL: 56-bit relfilenodes, 64-bit XIDs, etc. I think we can do significantly better than that in most, if not all, cases. For PostgreSQL 17, I'd like to propose an effort to improve our WAL infrastructure. The tail of this mail contains identified areas for improvement and feasibility analysis for improving on those items. There are probably more issues and potential improvements, but these are the ones I was aware of. Note that I'm mentioning PostgreSQL 17 because I don't have a lot of time for 16, and I think changing WAL formats and behavior all at once reduces the total effort for keeping external tooling compatible (as opposed to piecemeal changes); "to rip off the band-aid". I'm sending this mail now to collect community feedback and to make the thread discoverable in the archives - I can't find any other threads in the -hackers archives that were created specifically to cover people's gripes with WAL and solutions to those gripes. Kind regards, Matthias van de Meent CC-ed Heikki, Robert, Andres and Dilip for their interest in the topic shown in the 56-bit relfilenumber thread, and Koichi for his work on parallel recovery. (sorry for the duplicate mail, I misconfigured my sender address) ------------ I am aware of the following ideas that exist, several of which came up at the FOSDEM Developer Meeting last Thursday [1][2]: Reducing the size of the XLog record header: ============ We currently store XIDs in every XLog record header, where only some need them. E.g. most index records do not need XIDs for recovery, nor conflict resolution. The length field is 4 bytes, but many records are