How to revert Postgres to some time ealier?



  • Consider this scenario, I made some update to a running Postgres database, and some bad things happen.

    Now I want to rollback the database to 1 hour earlier, what's the process to achieve this?

    I was reading https://www.postgresql.org/docs/14/continuous-archiving.html , and but didn't find the relevant option for me to specify the rollback time. The most relevant one is recovery_target_timeline but I am not sure how it is applied.



  • There is no way to undo a committed transaction. You have to restore a physical (file system level) backup and use point-in-time-recovery to recover (forward) to a point before the problem happened.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2