by TheDBAdmin Team
pg_dirtyread: Recover deleted rows before VACUUM erases them
Someone ran a DELETE or UPDATE in production and there's no recent backup. With PostgreSQL's MVCC, the old row versions often stay in the table pages until VACUUM reclaims them. pg_dirtyread lets you read those dead tuples, stage them, and restore them with INSERT ... SELECT before that window closes. What's inside: - Why deleted and overwritten rows are still on disk, and what closes the recovery window (VACUUM, page pruning, space reuse) - First response in an incident: disable autovacuum on the affected table, check for a worker already running, pause writes, and recover on a copy, plus why none of this is a guarantee - Lab 1 - Delete, recover, and verify: read a deleted row and recover an overwritten value - Lab 2 - Restore and close the window: reinsert staged rows, then watch VACUUM remove the dead tuples - Lab 3 - Filter bulk deletes by the dead flag: recover only the rows a WHERE filter removed - Lab 4 - Recover from a copy and check settings: stage into a review table and reset autovacuum Every lab includes the exact commands, expected output and checkpoints, and runs in a disposable database. Prerequisites: PostgreSQL superuser access on a test server, with the pg_dirtyread extension package installed. Format: PDF, 5 pages.
No reviews yet. Be the first to review!
PDFClaiming adds this to your dashboard — you can download it right after.