Heap Table in PostgreSQL

Mike Notes

Some fascinating notes here about how the PostgreSQL database stores data. This information was prompted by an article in the Data Engineering Weekly

Resources

Notes from Quadcode



  • Data in Heap tables can be stored randomly on different pages and different places within the page. If you want to sort the data, use ORDER BY.

  • Each table has its own metadata with lots of information.
  • If the table is larger than a gigabyte, then Postgres begins to split it into separate files with a size of 1 gigabyte.
  • PostgreSQL uses a fixed page size, commonly 8 kB. The page structure simultaneously grows from top to bottom and from bottom to top.
  • Each page has a header, transaction pointers, a meta layer for each tuple and for each row.
  • The page has Fillfactor — the ability to store information only up to a certain level.
  • The object identifier is used only to generate the structure object number, but not for the content.

Notes from Drews Dev Blog

  • Loading a nice fresh Postgres install
  • Exploring the database folders
  • Let’s play with some data
  • Show me the files
  • What’s the heap?
  • So what’s a page?
  • Page layout
  • What happens when a row gets modifed or deleted?
  • What about indexes?
  • Why would I ever need to know any of this?
  • Further reading
  • Future topics
  • Updates
  • Footnotes

No comments:

Post a Comment