Compiled Conversations

The Life of a PostgreSQL Table, Part 2 with Bruce Momjian

Oct 13, 2025
Bruce Momjian, a PostgreSQL expert, dives deep into the lifecycle of a PostgreSQL table. He explains Multi-Version Concurrency Control (MVCC) and how it handles concurrent updates. Learn about the differences between lightweight and heavyweight table alterations, and the impact of type changes. Bruce shares insights on the vacuuming process, the Write-Ahead Log's role in durability, and the necessity of indexing for performance. He also discusses how Postgres manages deletions and the intricacies of transaction isolation levels, promoting a robust understanding of PostgreSQL internals.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Altering Tables Has Many Special Cases

  • Many ALTER TABLE operations are special-cased: some are fast catalog changes, others require full table rewrites and can double storage temporarily.
  • Adding a nullable column without default is cheap because existing rows implicitly treat it as null.
ADVICE

Plan For Costly ALTER TABLEs

  • Expect table rewrites and locking for data-affecting ALTERs and plan maintenance windows or use copy-based migrations.
  • Test changes on a copy to discover whether Postgres will rewrite the table or only adjust catalog metadata.
INSIGHT

Null Bitmap Makes Adding Nullable Columns Cheap

  • PostgreSQL stores a null bitmap per row and omits null columns from storage, so added nullable columns often cost nothing on disk.
  • The system treats absent bitmap entries as implicit nulls for newly added columns.
Get the Snipd Podcast app to discover more snips from this episode
Get the app