PostgreSQL glossary
File-Based Log Shipping
This is a method of syncing parent and child databases by applying WAL log files. Each WAL log file can store up to 16MB of data, and these files are sent only when they reach this size threshold. Note: This approach will cause a replication delay and also increase the chances of losing data if the parent database crashes and logs are not archived.
Hot standby (aka Streaming Replication)
This mechanism provides asynchronous binary replication to one or more standby databases. Standby databases may also become hot standby databases meaning they can be queried as a read-only database. This is the fastest type of replication because WAL data is sent immediately, without waiting for a complete segment to be produced and shipped. At the hot standby level, the same information is logged as with the archive, in addition to the information needed to reconstruct the status of running transactions from the WAL. To enable read-only queries on a standby server, wal_level must be set to ‘hot_standby’ or higher on the primary database, and hot_standby must be enabled in the standby database.
Streaming WAL records
WAL record chunks are streamed by database servers to maintain data synchronization. Standby servers establish connections with the parent server to receive these WAL chunks. WAL records are streamed as soon as they are generated and do not wait for the WAL file to be filled. This allows a standby server to stay more up-to-date than is possible with file-based log shipping. By default, streaming replication is asynchronous although it also supports synchronous replication.
WAL sender
WAL sender is a process in the primary server that is responsible for sending segments to a receiver.
WAL receiver
It is a process, in the standby server, that continuously listens for any incoming WAL segments from the primary server in its receive queue and applies the same on the source database.
WAL segments
The WAL files are stored as a set of WAL segment files. By default, each segment is 16 MB, and it is internally divided into pages of 8192 bytes (8 KB).
Warm standby (aka Log Shipping)
This is a high availability (HA) solution that replicates a database cluster to either an archive or a warm standby server (can be brought up quickly, but not available for querying). It offers minimal overhead and is easy to set up. This solution is well-suited for scenarios where the primary objectives are continuous backup and achieving short failover times.
Write Ahead Logging (WAL)
These are files that record all modifications made to the database before they are actually applied/written to data files.