Does TiDB support backup and restore of a specific partition in a partitioned table?

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB 支持分区表的某一个分区的备份恢复吗?

| username: TiDBer_jYQINSnf

As the title suggests: Is it supported to backup and restore one or several partitions of a partitioned table?

| username: tidb菜鸟一只 | Original post link

Backup and restore using dumpling and lightning is possible, others are not.

| username: TiDBer_jYQINSnf | Original post link

Let me elaborate.
Any method is acceptable.
Here’s the situation:
We have set up two TiDB clusters with dual-write data.
The tables are partitioned by date. Dual-writing started in March.
Data before March is only available on the source end. We plan to transfer the data before March to the target end through backup and restore. We won’t back up and restore data after March.
The data before March has not been modified.

| username: DBAER | Original post link

Is it possible to directly export a logical backup? It seems like the data you exported is cold data.

| username: DBAER | Original post link

A similar format should work, specifying the partition should be sufficient.

| username: tidb菜鸟一只 | Original post link

Directly export the data before March from your source table to a CSV file using dumpling with SQL:

./dumpling -u root -P 4000 -h -o /tmp/test --filetype csv --sql 'select * from `test`.`sbtest1` where id < 100' -F 100MiB --output-filename-template 'test.sbtest1.{{.Index}}'

Then, import the CSV into the target end using lightning.

| username: TiDBer_jYQINSnf | Original post link

This is possible, but if the data volume is large, it will be slower and affect performance more significantly.

| username: terry0219 | Original post link


| username: TiDBer_QYr0vohO | Original post link

Dumpling can achieve this, but BR physical backup cannot.

| username: xiaoqiao | Original post link

Logical export.

| username: 舞动梦灵 | Original post link

There’s no need to use this backup for partitioning. Just use logical export with mysqldump, or TiDB’s own Dumpling.