Sobes.tech
Senior

Types of replication in PostgreSQL

sobes.tech AI

Answer from AI

In PostgreSQL, there are main types of replication:

  • Streaming Replication — asynchronous or synchronous replication at the WAL (Write-Ahead Logging) level. The primary server transmits changes in real-time to replicas.

  • Logical Replication — allows replicating individual tables or data with transformation capabilities. Uses publications and subscriptions.

  • Physical Replication — copying physical database files, usually used for creating hot backups.

  • Cascading Replication — replication where one replica acts as a source for another, creating a chain of replicas.

Each type is suitable for different scenarios: streaming for high availability, logical for migrations and partial replication.

Types of replication in PostgreSQL — Golang - sobes.tech