Search code examples
postgresqlpg-restore

Is a PostgreSQL database accessible during restore?


Is it possible to access, particularly insert into, a database while it's being restored by pg_restore from a custom format. If yes, then should I care about preventing clients from accessing the database while pg_restore is running, or the restore operation is "transactional" so that after it ends all changes made by clients since its start will be lost?


Solution

  • If you want to keep concurrent sessions out of your database during pg_restore, you'll have to block them with a pg_hba.conf entry.

    There is no protection from concurrent sessions inserting or otherwise modifying data while pg_restore is running.