Restoring database with a different number of partitions

Hi Team,

I have a database backup with 116 partitions, and I would like to restore it to a new database with fewer partitions (58).
According to this docs it’s possible, but I get an error that the database already exists:

<database_name> is the SingleStore database to restore to. This database doesn’t need to have the same number of partitions or leaves as the source workspace from the backup. This database may also have a different redundancy level so long as it is using a Network File System.

Please assist,
Chen.

Hi @chen, the backup and restore process is based on the binary, physical format of the data, so the number of partitions in the restored database has to be the same in the original database and the restored database.

It is possible to create a backup while splitting the number of partitions by 2, as described here.

It’s not possible to directly merge partitions. The best way to merge partitions is to create a new database with fewer partitions, but otherwise the same table/sharding/sorting/indexes, then insert-select the data from the old database to the new one.

On cloud, you can rename the final database by detaching it and attaching it with a new name, if you are using Unlimited Storage databases.

The documentation statement “doesn’t need to have the same number of partitions” is not correct. I’ll open a ticket to get that fixed.