Redrock Postgres Documentation
Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Can I modify the template database when making a base backup?

Description

If a CREATE DATABASE command is executed while a base backup is being taken, and then the template database that the CREATE DATABASE copied is modified while the base backup is still in progress, is it possible that recovery will cause those modifications to be propagated into the created database as well?

Answer

Yes, you can modify the template database when making a base backup.

When creating a database, Redrock Postgres accesses the data page of the template database through shared buffer and copies the data to the data page of the new database. WAL logs are recorded for each data page. Therefore, If a CREATE DATABASE command is executed while a base backup is being taken, and then the template database that the CREATE DATABASE copied is modified while the base backup is still in progress, the recovery will use the recorded WAL logs to restore the created database.