Basic concepts behind PITR
Point in Time Recovery, usually written as PITR, is a technique that allows you to restore your database at a specific point in the past. Showing you how to use PITR is out of the scope of this chapter, and this section only explains the basic concepts behind the technique.
PITR can be achieved only by means of physical backup, and it is usually performed via specific backup tools like the aforementioned pgBackRest
, even though PostgreSQL provides all the needed infrastructure to perform PITR.
The main idea behind PITR is to start with a physical backup and then continuously store the database WAL segments, a process called WAL archiving. The WALs can be stored locally or sent to a remote machine, usually a specific backup machine. The need to archive all the WALs is that, as already explained in Chapter 11, PostgreSQL recycles the WALs once the modified data is safely stored on the disk; therefore, in order to get a continuous stream of WALs, the...