How to Accurately Calculate the Data Size of a TiDB Database?

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

Original topic: TiDB数据库数据量大小,应该如何计算才比较准确?

| username: tidber1234

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
What is the most accurate method to check or calculate the data size in a TiDB database? Should we look at the disk space occupied by data files, calculate the sum of table sizes in the database, or check the storage usage in Grafana?

| username: Kongdom | Original post link

It depends on what size you are looking for. Since it is multi-replica, if you are looking at the actual data size, you only need to consider the size of the primary replica. If you are looking at the total data size, then it would be three times the size.

Here is a similar Q&A: