Breaking away from FREEZE and Wraparound - Masahiko Sawada - PGCon 2022

PostgreSQL transactions face limitations with XIDs due to wraparound and freezing. This talk proposes a 64-bit XID approach and discusses solutions, including XID ranges, page upgrade formats, and disk compatibility considerations.

Key takeaways
  • Transaction IDs (XIDs) are a major issue in PostgreSQL due to wraparound and freezing.
  • The traditional solution is to maintain a 32-bit XID, resulting in freezing tables after 2 billion transactions.
  • To address this, a 64-bit XID approach is proposed, which would enable larger transaction IDs and reduce freezing occurrences.
  • The 64-bit XID approach involves adding an extra 32-bit XID to the page, currently using 32-bit XID on tuple headers.
  • Another idea is to use XID ranges, where ranges of XIDs are created and the LSN marks the start of each range.
  • The freeze map concept helps in freezing tables by identifying frozen pages and reducing disk I/O.
  • The paper also discusses the page upgrade format and online page upgrade, which allows for upgrading page formats without disrupting database activity.
  • Resource consumption and disk compatibility are important factors to consider when implementing XID-related improvements.
  • Various approaches have been proposed to address XID-related issues, including the introduction of the visibility map and the freeze map.
  • The age function returns the distance between the frozen XID and the current XID.
  • Index cleanup and vacuuming are essential for maintaining database health.
  • The community is open to new ideas and is considering the 64-bit XID approach for addressing XID-related problems.