Sign InTry Free

TiDB Data Migration Shard Merge

TiDB Data Migration (DM) supports merging the DML and DDL data in the upstream MySQL/MariaDB sharded tables and migrating the merged data to the downstream TiDB tables.

If you need to migrate and merge MySQL shards of small datasets to TiDB, refer to this tutorial.


Currently, the shard merge feature is supported only in limited scenarios. For details, refer to Sharding DDL usage Restrictions in the pessimistic mode and Sharding DDL usage Restrictions in the optimistic mode.

Configure parameters

In the task configuration file, set shard-mode to pessimistic:

shard-mode: "pessimistic" # The shard merge mode. Optional modes are ""/"pessimistic"/"optimistic". The "" mode is used by default # which means sharding DDL merge is disabled. If the task is a shard merge task, set it to the "pessimistic" # mode. After getting a deep understanding of the principles and restrictions of the "optimistic" mode, you # can set it to the "optimistic" mode.

Handle sharding DDL locks manually

In some abnormal scenarios, you need to handle sharding DDL Locks manually.

Was this page helpful?

Download PDFRequest docs changesAsk questions on DiscordEdit this page
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
TiDB Dedicated
TiDB Serverless
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.