A 1 TB PostgreSQL database with hot data that must not be lost is running in the cluster. A pg_dump is created once a day. What’s wrong with this, and how can it be improved?
Asked at
AI answer
A daily pg_dump implies a potential loss of up to a day’s worth of data (RPO of about 24 hours), while restoring 1 TB can take a very long time (high RTO). A single logical dump can also impose a significant load, and the time and reliability of restoration need to be tested.
First, determine the acceptable RPO and RTO. Point-in-time recovery is usually implemented with regular physical base backups and continuous WAL archiving, for example with pgBackRest or Barman. This allows you to restore a base backup and apply WAL up to the desired point in time. For fast failover, you can add a replica; synchronous replication reduces the risk of losing acknowledged transactions, but by itself does not replace backups and does not protect against deletions or logical corruption that gets replicated.
Backups should be stored separately from the cluster, encrypted, and monitored for successful completion and retention period. Most importantly, regularly test restores in a separate environment and measure the actual RPO/RTO. pg_dump can still be used for logical or selective restores, but not as the sole strategy for a database of this size.
Also asked at NWIRE Professional
- What is WAL in PostgreSQL?
- What are the main components of the control plane in Kubernetes?
- What is a replication factor in Kafka and how does min.insync.replicas work?
- What is the minimum number of master nodes we need to achieve basic high availability (HA), and why?
- Как организуется отказоустойчивость (High Availability и Failover) в PostgreSQL на self-hosted инфраструктуре?
Similar questions
- How would you approach continuous backup and protection of PostgreSQL data with an RPO close to zero, where losing even a few transaction rows is unacceptable?
- What tool do you use to back up PostgreSQL databases?
- How do you back up PostgreSQL? How do you create a logical or physical backup, and what other methods are available?
- How would we back up PostgreSQL in Kubernetes?
- How is Point-in-Time Recovery (PITR) implemented in PostgreSQL, and what is required for it?