🤖 Backend
PostgreSQL
Pages in Postgresql

Pages in PostgreSQL

What is Page?

  • Page is smallest unit of data storage
  • Every table and index is stored as an array of pages of fixed size
  • By default, in PostgreSQL the size of page is 8kb which configurable

Why do we need a different page size?

  • Usually in Datawarehouse, it needs higher page size!

Page Layout

Page Layout

ItemDescription
PageHeaderData24 bytes long. Contains general information about the page, including free space pointers.
ItemIdDataArray of item identifiers pointing to the actual items. Each entry is an (offset,length) pair. 4 bytes per item.
Free spaceThe unallocated space. New item identifiers are allocated from the start of this area, new items from the end.
ItemsThe actual items themselves.
Special spaceIndex access method specific data. Different methods store different data. Empty in ordinary tables.

Reference: https://www.postgresql.org/docs/current/storage-page-layout.html (opens in a new tab)

Reference

https://www.youtube.com/watch?v=RaX6C_xYbV0 (opens in a new tab)