Incremental Backups on Columnstores
On this page
Note
This section does not apply to SingleStore Helios or to backups made using the SingleStore Toolbox sdb-admin create-backup command.
An incremental backup contains only the changes to columnstore data that were made since the previous backup was taken.
You cannot perform incremental backups to a local file system because on failover or any movement of a master partition the incremental backups remain on the old host.
A backup set contains an initial full backup followed by any number of incremental backups.
Note
You can make an incremental backup on a database that has rowstore data, but a full copy of the rowstore data will be saved in each incremental backup.
Making Incremental Backups
Suppose you want to store incremental backups for one week in the same backup set.
First, you make an initial full backup by running the BACKUP DATABASE
command and include the WITH INIT
clause.
BACKUP DATABASE test_db WITH INIT to "/test_db_backups_week_1";
To make the first incremental backup, run the BACKUP DATABASE
command and include the WITH DIFFERENTIAL
clause.
BACKUP DATABASE test_db WITH DIFFERENTIAL to "/test_db_backups_week_1";
To make the second incremental backup, run the same command again:
BACKUP DATABASE test_db WITH DIFFERENTIAL to "/test_db_backups_week_1";
To view the history of the incremental backups taken in the cluster, query information_
.
SELECT backup_id, incr_backup_id, database_name, start_timestampFROM information_schema.mv_backup_historyORDER BY backup_id;
+-----------+----------------+-----------------+---------------------+
| backup_id | incr_backup_id | database_name | start_timestamp |
+-----------+----------------+-----------------+---------------------+
| 10 | 10 | test_db | 2019-08-04 00:00:00 |
| 11 | 11 | test_db | 2019-08-05 00:00:00 |
| 12 | 12 | test_db | 2019-08-06 00:00:00 |
+-----------+----------------+-----------------+---------------------+
Restoring an Incremental Backup
Note
You can restore an incremental backup into 7.
You can restore an incremental backup from one taken in 7.
In SingleStore, creating or restoring a backup to/from a local filesystem is not supported.
To restore an incremental backup, run the RESTORE DATABASE
command, including the WITH FILE
clause.incr_
of the incremental backup that you want to restore.
The following command assumes the backups in the previous section, Making Incremental Backups, have been made.incr_
12
.incr_
10
and applies the changes with the incr_
11
and 12
to restore the backup.
RESTORE DATABASE test_db FROM "/test_db_backups_week_1" WITH FILE = 12;
You can restore any incremental backup from a backup set.
Making Frequent Incremental Backups and Occasional Full Backups
When you make an incremental backup, it may no longer contain columnstore data that was in a previous incremental backup.
To save space, you can make incremental backups and occasional full backups.
Example
-
Make incremental backups on every day of the week except Sunday.
-
On Sunday, take a initial full backup (using
BACKUP DATABASE .
).. . WITH INIT This will create a new backup set. -
Store the backups for each week in a separate directory.
-
When the full backup made on the Sunday of a new week succeeds, delete the backup directory for the previous week (if desired).
Incremental Backup Performance
If you run OPTIMIZE TABLE prior to making an incremental backup, the backup take significantly longer to complete than it normally would.OPTIMIZE TABLE FULL
sorts the entire columnstore table.
Last modified: March 8, 2024