Creating Table Partitions for Existing Tables in TiDB

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

Original topic: TiDB如果对已存在表,创建表分区

| username: TiDBer_QHSxuEa1

The situation is like this: the table was migrated from MySQL, and later it was found that partitioning operations needed to be performed on the table. However, using MySQL’s ALTER TABLE to change the table partition resulted in an error. Does TiDB support creating table partitions on existing tables? If so, how should the statement be written?

| username: zhanggame1 | Original post link

Direct modification is not supported, right? Just create a new partitioned table and insert the data. How much data is there?

| username: redgame | Original post link

Create a partitioned table, perform data synchronization, and then rename it.

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

Not supported.

| username: 像风一样的男子 | Original post link

How large is the dataset? I have a table with over 10 billion records, and querying without partitioning is not an issue.

| username: Kongdom | Original post link

TiDB does not support this type of modification. You need to create a new table and import the data into the partitioned table format.

| username: cassblanca | Original post link

It does not support directly modifying and creating new tables to synchronize data, right?

| username: 有猫万事足 | Original post link

Here is the document, you can take a look.

| username: TiDBer_QHSxuEa1 | Original post link

Doing tests, approximately more than 30 million data.

| username: TiDBer_QHSxuEa1 | Original post link

Okay, thank you.

| username: TiDBer_QHSxuEa1 | Original post link

Is it really that powerful? Can it still perform well with such large tables when doing table joins?

| username: TiDBer_QHSxuEa1 | Original post link

Got it, thanks.

| username: zhanggame1 | Original post link

More than 30 million is not considered very large. For TiDB, partitioning or not both work. Partitioning mainly makes it easier to delete data.

| username: Jellybean | Original post link

TiDB does not support converting an existing non-partitioned table to a partitioned table; you can only create a partitioned table when you initially create the table.

| username: system | Original post link

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