Choose between back up and restore or import and export


Spanner import and export serves many of the same use cases as back up and restore. The following table describes similarities and differences between them to help you decide which one to use.

Back up and restoreImport and export
Data consistency Both backups and exported databases are transactionally and externally consistent.
Performance impact Backups have no impact on an instance's performance. Spanner performs backups using dedicated jobs that do not draw upon an instance's server resources. Export runs as a medium-priority task to minimize impact on database performance. For more information, see task priority.
Storage format Uses a proprietary, encrypted format designed for fast restore. Supports both CSV and Avro file formats.
Portability You create backups in the same instance as their source database.

After a backup is created, you can copy the backup to an instance in a different region or project if you need a cross-region or cross-project backup. You can then restore from a backup as a new database to any instance in the same project. The instance that you are restoring to should have the same instance configuration as the instance where the backup is stored.
Exported databases reside in Cloud Storage and the data can be migrated to any system that supports CSV or Avro.
Retention Backups can be retained for up to 1 year. Exported databases are stored in Cloud Storage where, by default, they are retained until they are deleted. You can customize lifecycle and retention policies.
Pricing Backups are billed to your Spanner project based on the storage used per unit time. For more details, see the Pricing section. Billing for import and export is more complicated due to its use of Cloud Storage and Dataflow. For more information, see Database export and import pricing.
Restore time Restore happens in two operations: restore and optimize. The restore operation offers fast time-to-first-byte because the database directly mounts the backup without copying the data. After the restore operation completes, the database is ready for use, though read latency might be slightly higher while it is optimizing. For more information, see How restore works. Import is slower. You need to wait for all the data to be written into the database.

What's next