Join the MemSQL Community Today
Get expert advice, develop skills, and connect with others.
MemSQL Helios does not support this command.
Rebalances the partitions for a database.
REBALANCE PARTITIONS ON db_name [FORCE]
db_nameis the name of a MemSQL database.
REBALANCE_PARTITIONSrestores redundancy by replicating any partitions with only one instance, and then moving partitions around to ensure balance across all the leaves. Use
RESTORE REDUNDANCYinstead if you want to restore redundancy only, without rebalancing partitions.
FORCEoption causes rebalance to create empty partitions for any partition on the cluster which has neither a master nor replica partition attached. Use this option carefully. If an offline node has the only copy of a partition then running
FORCEwill cause the offline node’s partition to be orphaned. When the offline node comes back online the partition won’t be attached back to the cluster. It will have been replaced with an empty partition by rebalance. For some example cases where
FORCEis useful, see Dealing with Failures.
REBALANCEis going to execute, run EXPLAIN REBALANCE PARTITIONS.
REBALANCEis an online operation, meaning that as it runs you can continue to read and write data in the database you are rebalancing. However, since
REBALANCEoften needs to move the location of a master partition to another leaf, write transactions may experience some temporary blocking during the rebalance as this happens.
memsql> REBALANCE PARTITIONS ON test; Query OK, 1 row affected (9.80 sec)