postgres storage page - ghdrako/doc_snipets GitHub Wiki

The pages 8KB have a defined structure. At the front, there’s the PageHeaderData. This is a 24-byte collection of data about the page. It includes things like the Write Ahead Log (WAL) Log Sequence Number (LSN) for the latest write to the page, an offset to where the free space within the page starts and other information about the data on the page. Next You get a set of Item ID values. These are long term pointers to the data and include information like how long the piece of data is and where it’s located.Data is written backwards on the page, so the free space and offset needed to find it are opposite the set of ID pointers to the data itself.The final bit of the page, Special Space, isn’t used by tables. It’s generally used by indexes to define storage, linked lists, and other things like that, depending on the index type.