Using TiDB Data Partitioning

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

Original topic: tidb数据分区使用

| username: Jolyne

【TiDB Usage Environment】Production, Testing, Research
Production
【TiDB Version】
5.2
【Encountered Problem】
Does TiDB support automatic partition creation and deletion of historical partitions? For example, if partitions are created based on time, and there are 4 partitions with the last partition’s time being today, can it automatically create a partition for tomorrow (changing the partition mode to dynamic)? Is there a parameter setting to automatically create or delete partitions when creating a table?
For example, settings in other distributed databases:

(
“dynamic_partition.enable” = “true”,
“dynamic_partition.create_history_partition” = “true”, – Enable historical partitions
“dynamic_partition.history_partition_num” = “7”, – Number of historical partitions
“dynamic_partition.time_unit” = “DAY”,
“dynamic_partition.end” = “7”,
“dynamic_partition.prefix” = “p”,
“dynamic_partition.buckets” = “20”,
“replication_num” = “3”
);

【Reproduction Path】What operations were performed that led to the problem
【Problem Phenomenon and Impact】

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: h5n1 | Original post link

This feature is not supported yet, but it will be available in future versions.

| username: xfworld | Original post link

Dynamic partitioning is not supported, but you can set partitions according to your own needs by referring to the official documentation:

Subsequently, you can define new partitions within this range
image

| username: Jolyne | Original post link

Okay, thank you. I’ve looked into this. Since we have a task that requires partitioning by time, it would be quite troublesome if manual addition cannot be automatically extended.

| username: alfred | Original post link

“Range partitioning, List partitioning, and List COLUMNS partitioning can be used to address performance issues caused by large-scale deletions in business scenarios, supporting quick partition deletions. Hash partitioning can be used to distribute data in scenarios with heavy write operations.”
Can distributed tables in TiDB improve query performance?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.