Restore deleted records in PostgreSQL

2020-08-14 07:39发布

问题:

I accidentally deleted all the records from 3 tables in PostgreSQL. How can i restore the data?

回答1:

This is a similar problem as discussed here:

Can I rollback a transaction I've already committed? (data loss)

Basically, restore from backup. If you can't, you might be able to recover with pg_dirtyread.

If you don't have backups, stop the whole server, take a disk image of the drive, and contact a $lots data recovery expert.