Logical Change Records, the logical WALs - Ashutosh Bapat - PGCon 2022

Learn about Logical Change Records, a new technology that can replace Write-Ahead Logs for logical replication, improving efficiency, transaction throughput, and replication lag in PostgreSQL systems.

Key takeaways
  • Logical Change Records (LCRs) are a new technology that can replace Write-Ahead Logs (WALs) for logical replication.
  • LCRs are smaller and more efficient than WALs, taking up less space and improving CPU usage.
  • LCRs are transaction-aware, whereas WALs are not, which improves replication lag and transaction throughput.
  • The wall decoder process reads the WAL stream, reorders it, and produces LCRs, which are then sent downstream.
  • The wall sender process reads LCRs and sends them to downstream nodes, reducing CPU and disk load.
  • With LCRs, the wall sender process does not need to perform logical decoding, which improves CPU usage and reduces replication lag.
  • The wall decoder process can be run in parallel with the wall sender process, improving performance and reducing CPU usage.
  • LCRs can be used for logical backup and improve wall retention.
  • The technology is being developed for BDR (Bi-Directional Replication) and has two components: the wall decoder process and the LCR process.
  • The wall decoder process reads the WAL stream, reorders it, and produces LCRs, which are then sent downstream.
  • The LCR process reads LCRs and applies them to the database on the downstream node.
  • The technology improves CPU usage, reduces replication lag, and increases transaction throughput.
  • The wall sender process can be run in parallel with the wall decoder process, improving performance and reducing CPU usage.
  • The technology is being tested with PG bench and has shown promising results.
  • The technology is expected to improve performance and reduce CPU usage in systems with high load and high number of wall senders.