Optimization of Table Creation in TiDB Database

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

Original topic: TIDB数据库创建表优化

| username: 每天当牛马

Creating tables in TiDB takes a long time. For tables below 5000, the creation time is as shown. When the number of tables reaches 60,000, creating a similar table takes 400ms. Are there any solutions to optimize the table creation speed?

| username: zhanggame1 | Original post link

There’s no good solution. Why did you create so many tables?

| username: 每天当牛马 | Original post link

Is it normal for the table creation time to increase as the number of tables increases due to project requirements?

| username: 随缘天空 | Original post link

Why create so many tables at once? If the number is large, create the tables in batches. Secondly, optimize the table structure: check whether the table structure is reasonable and whether there are unnecessary fields or indexes.

| username: linnana | Original post link

This kind of batch table creation time shouldn’t be a major concern, right?

| username: wangccsy | Original post link

Creating good indexes is crucial.

| username: changpeng75 | Original post link

Of course, it’s normal. Metadata such as table information also needs to be maintained.

| username: Kongdom | Original post link

:thinking: Would it be better to use partitioned tables? The table name prefixes in the screenshot are all the same.

| username: 小龙虾爱大龙虾 | Original post link

Don’t create so many tables.

| username: zhanggame1 | Original post link

Is it possible to merge the data that has been sharded into different databases and tables in TiDB?

| username: dba远航 | Original post link

The more tables you create, the larger the metadata table that manages table information becomes, and naturally, the slower it gets.

| username: 哈喽沃德 | Original post link

Isn’t this fast enough? It’s all at the millisecond level.