news.volyx.in

How Postgres stores data on disk – this one's a page turner (drew.silcock.dev)

556 points by drewsberry · 735 days ago · 91 comments on HN

Article summary

The article explores how Postgres stores data on disk, starting with a fresh Postgres installation and examining the database folders and files. It discusses the different types of files and folders, including the base directory, system catalogs, and data files. The article also delves into the concept of pages and the heap, explaining how Postgres stores data in a heap and how pages are used to manage data. The author aims to provide a detailed understanding of Postgres' data storage mechanisms.

Main themes

  • Postgres data storage
  • Database internals
  • File system organization
  • Data integrity
  • Performance optimization
  • Database design

What commenters say

  • The title of the article was modified by Hacker News, removing the leading 'How', which changed the meaning and caused confusion among readers.
  • Some commenters argue that the automatic removal of 'filler words' from titles is not always useful and can be harmful, while others suggest it could be improved with a more sophisticated algorithm.
  • There is a discussion about the optimal page size for Postgres, with some arguing that it should be related to the file system page size for atomicity, while others point out that this may not be the case with modern SSDs.
  • Some commenters believe that data checksums are essential for data integrity, even if the underlying file system provides some level of protection, while others argue that checksums may be redundant in certain cases.
  • The choice of page size in Postgres is a trade-off between performance and data integrity, and different use cases may prioritize one over the other.
  • The use of ECC memory can provide some protection against data corruption, but it may not be sufficient in all cases, and additional measures like checksums may still be necessary.