How to Determine the Size Occupied by a Table

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

Original topic: 如何确认一张表的占用的大小

| username: yulei7633

  1. When learning TiDB, I always think about comparing it with MySQL.
    Currently, in MySQL, to check the size of a table, you can intuitively determine the size by looking at the physical file test.ibd. However, in TiDB, how do you determine the size of a table?
| username: 啦啦啦啦啦 | Original post link

Refer to this link:

| username: zhanggame1 | Original post link

I don’t understand what this SQL is querying. Is it the total size of all related regions in TiKV?

| username: yulei7633 | Original post link

May I ask, what is the unit of the size that comes out of this?

| username: yulei7633 | Original post link

The image you provided is not accessible. Please provide the text you need translated.

| username: 啦啦啦啦啦 | Original post link

The unit should be MB.

| username: yulei7633 | Original post link

Sure, here’s the translation:

“Okay, there’s one more question. This statement determines the size of a table. How do you determine the size of the entire database?”

| username: 人如其名 | Original post link

The evaluation results obtained through this method are often inaccurate. Refer to this method for statistics: ops/get_table_size.py · wencycool/something_for_tidb - Gitee.com

| username: yulei7633 | Original post link

This is too complicated. I can’t understand it at all.

| username: zhanggame1 | Original post link

This Python script is too long.

| username: 人如其名 | Original post link

You don’t need to understand it; you can follow the instructions and execute directly. It won’t have any impact on the system.

| username: yulei7633 | Original post link

Okay, I’ll give it a try.

| username: system | Original post link

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