Avoiding, Detecting, and Recovering From Data Corruption
summary
PostgreSQL corruption usually stems from three concrete causes: bad disk/memory, software bugs (OS, FS, backup tool), or unsafe backup/restore scripts. Key defenses are repeatable tested backups and restores, fsync and full_page_writes enabled, correct wal_sync_method, and pg_checksums enabled to detect bitrot. Recovery workflow is: copy all data files, try pg_dump into a fresh initdb, use pg_resetwal only to start when WALs are missing, or use pg_file_dump to extract raw rows; expect manual fixes for logical constraints.
AI-written summary · about
chapters (17)
- 0:00Introduction to corruption
- 2:36Defining database corruption
- 5:06Causes of corruption
- 7:34Best practices overview
- 9:39Backup and restore strategies
- 11:24PostgreSQL configuration
- 15:16Checksums and detection
- 16:42Storage best practices
- 20:31File system recommendations
- 23:00Monitoring storage errors
- 24:03Database administration
- 25:49Avoid manual data file changes
- 27:58Plug testing and recovery
- 28:41Signs of corruption
- 33:36Recovering from corruption
- 36:47Dumping corrupted data
- 45:15Final summary and Q&A
