How many databases and tables can a standard TiDB cluster support at maximum?

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

Original topic: 一个标准的tidb集群,最大支持创建多少个库,多少个表

| username: Holland

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Symptoms and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: Kongdom | Original post link

This should be related to the size of the table. It feels like there shouldn’t be a limit if we’re only talking about the quantity.

| username: Holland | Original post link

Yes, the documentation also states that there are no limitations: TiDB 使用限制 | PingCAP 文档中心

| username: Kongdom | Original post link

:yum: Just searched for MySQL on Baidu, and there are various opinions~ There’s no definitive conclusion.

| username: Holland | Original post link

Yes, the main consideration is whether having a large number of databases will affect performance.

| username: 大飞哥online | Original post link

The actual number of supported databases and tables is limited by factors such as hardware resources, storage capacity, and performance.

| username: 大飞哥online | Original post link

If you need to create a large number of databases and tables, it is recommended to evaluate and test based on the actual situation to ensure system stability and performance.

| username: Fly-bird | Original post link

Unlimited if resources are sufficient.

| username: Kongdom | Original post link

:thinking: I think having more databases will affect performance. Essentially, more databases mean more data and more interactions.

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

No restrictions

| username: Miracle | Original post link

Theoretically, there is no limit. In practice, the limitation should be on the amount of data and hardware resources.

| username: Jellybean | Original post link

There is no limit to the number of databases and tables in a single cluster.

| username: forever | Original post link

I think the number of databases should not affect performance. For example, having 100 tables in one database or 20 tables in each of 5 databases should have the same performance.

| username: zhanggame1 | Original post link

In theory, there are no limitations, but in practice, having too much metadata and statistical data can still impact performance.

| username: TiDBer_vfJBUcxl | Original post link

No limitations

| username: Tom_wu | Original post link

If we don’t talk about resources and only discuss support for creation, then there are certainly no limitations. :grin:

| username: 昵称想不起来了 | Original post link

If you’re worried about performance impact, you can use sysbench to simulate the actual situation and test it.

| username: TiDBer_小阿飞 | Original post link

Understood. Please provide the Chinese text you would like translated.

| username: residentevil | Original post link

I have conducted stress tests, and for the limitation on the number of tables, it is recommended to keep it within ten thousand. Additionally, it is better to set a limit on the number of rows per table because TiDB’s efficiency in collecting statistics is particularly poor, especially in versions prior to v6.5. I’m not sure how the optimization has improved in versions v7.1 and above. If there are too many tables, the slow collection of statistics can directly lead to inaccurate execution plans, which could cause catastrophic failures in a production environment.

| username: Holland | Original post link

How can I make the simple table statements faster? I have 100,000 databases, and each database needs to create 200 tables. Now the databases are created, but creating the tables is very slow.