Scenario
An e-commerce platform runs MySQL (500GB) and PostgreSQL (300GB). Full backups take 6 hours, restores 8 hours, exceeding SLAs (RTO<4h, RPO<1h).
Symptoms
- CPU 100%, I/O wait >50% during backups.
- MySQL writes blocked due to table locks.
- PostgreSQL pg_dump slow, WAL archiving lag.
- Recovery spends 70% time on redo log replay.
Diagnosis
MySQL
SHOW GLOBAL STATUS LIKE 'Innodb_rows_inserted';check write impact.iostat -x 1monitor disk latency.- Review backup command: prefer
--single-transaction --compress --quick.
PostgreSQL
pg_stat_activityidentify waiting sessions.pg_statio_user_tablescheck cache efficiency.pg_waldumpanalyze WAL growth.
Optimization Commands
MySQL
- Physical backup:
xtrabackup --backup --parallel=4 --compress --compress-threads=4 --target-dir=/backup. - Increase
innodb_buffer_pool_sizeto 70% of RAM.
PostgreSQL
- Streaming backup:
pg_basebackup -D /backup -X stream -P -v -z -Z 9 --wal-method=stream. - Tune
max_wal_sendersandwal_keep_segments.
Risk Controls
- Use
--single-transactionfor InnoDB consistency without locks. - For MySQL, disable
--lock-tablesif already using transactions. - Test restores monthly in a sandbox environment.
Rollback
- Incremental backups: xtrabackup
--incremental-basedir; PostgreSQLpg_basebackupwith replication slots. - Prepare PITR scripts:
mysqlbinlogfor MySQL;pg_restore --timefor PostgreSQL.
Verification
- After restore, run
pt-table-checksum(MySQL) orpg_verify_checksums(PostgreSQL). - Measure actual RTO with simulated failover.
When to Submit an OpsGlobal Ticket
- Backups consistently exceed SLA despite tuning.
- Recovery drills fail; need expert assistance.
- Complex incremental backup chain issues.
Use cases
Useful for teams handling Database issues and needing a clear troubleshooting and delivery workflow.
Problem background
A practical deep-dive into diagnosing and improving backup/restore performance for MySQL and PostgreSQL, with commands, risk controls, and rollback strategies for SRE teams.
Troubleshooting steps
Confirm impact and recent changes, collect logs, configuration and metrics, then apply fixes from low to high risk.
Command examples
Replace sample resource names with real values and store passwords, tokens and keys in environment variables.
Risks
Before production changes, confirm backups, access boundaries, change windows and rollback paths.
Rollback plan
Keep original configuration and release versions; roll back config, images or database changes if metrics degrade.
Deliverables
Root-cause notes, key commands, remediation steps, verification results and follow-up recommendations.
Need help with a similar technical issue?
If your servers, Kubernetes, Docker, CI/CD, databases or monitoring systems have similar issues, submit logs and config files for remote diagnosis.