Why Logical Replication?

January 06, 2016

PostgreSQL has built-in streaming replication. Why do we need new replication?

Well, in some cases, we do need more. Which is why we have pglogical.

The existing replication is more properly known as Physical Streaming Replication since we are streaming a series of physical changes from one node to another. That means that when we insert a row into a table we generate change records for the insert plus all of the index entries. When we VACUUM a table we also generate change records.

Also, Physical Streaming Replication records all changes at the byte/block level, making it very hard to do anything other than just replay everything.

Logical Streaming Replication sends changes in a more flexible form, sending only the logical change. So when we do an insert we send only the insert record, not various other records as well. Even better, the logical records work across major releases, so we can use this to upgrade from one release to another.

Other than that, much of the technology to send data is the same between logical and physical streaming replication.

pglogical is an extension for PostgreSQL, working for 9.4 and 9.5. Plus its submitted to PostgreSQL core as a future inclusion, hopefully for 9.6.

Share this

More Blogs

RAG app with Postgres and pgvector

Build a RAG app using Postgres and pgvector to enhance AI applications with improved data management, privacy, and efficient local LLM integration.
October 08, 2024

Mastering PostgreSQL in Kubernetes with CloudNativePG

Previewing EDB’s training session for PGConf.EU 2024, presented by our Kubernetes experts EDB is committed to advancing PostgreSQL by sharing our expertise and insights, especially as the landscape of database...
September 30, 2024

The Expanding World of AI and Postgres

It wasn’t long ago that AI was considered a niche topic of interest reserved for researchers and academics. But as AI/ML engineers with extensive research backgrounds entered the industry, AI...
September 25, 2024