Note
This view is available starting with V4.3.4.
Purpose
This view displays the sizes of all user tables (based on the leader replica in a multi-replica environment) across all tenants.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TENANT_ID | varchar(128) | NO | The tenant ID. |
| TABLE_ID | bigint(20) | NO | The table ID. |
| TENANT_NAME | varchar(128) | NO | The tenant name. |
| DATABASE_NAME | varchar(128) | NO | The database name. |
| TABLE_NAME | varchar(256) | NO | The table name. |
| OCCUPY_SIZE | decimal(42,0) | NO | The size of the compressed data stored on disk, in bytes. |
| REQUIRED_SIZE | decimal(42,0) | NO | The actual disk space occupied by the compressed data stored on disk, in bytes. |
Sample query
In SN mode, query the sizes of all user tables across all tenants as the sys tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_TABLE_SPACE_USAGE LIMIT 10;
The query result is as follows:
+-----------+----------+-------------+---------------+---------------------+-------------+---------------+
| TENANT_ID | TABLE_ID | TENANT_NAME | DATABASE_NAME | TABLE_NAME | OCCUPY_SIZE | REQUIRED_SIZE |
+-----------+----------+-------------+---------------+---------------------+-------------+---------------+
| 1 | 500006 | sys | test | T1 | 1094 | 8192 |
| 1 | 500007 | sys | test | __idx_500006_IDX_C1 | 926 | 8192 |
| 1 | 500008 | sys | mysql | t2_m_lr | 2088 | 16384 |
| 1 | 500009 | sys | oceanbase | __idx_500008_IDX_C1 | 881 | 8192 |
| 1 | 500010 | sys | oceanbase | test1 | 493 | 4096 |
| 1 | 500011 | sys | oceanbase | __idx_500010_b_idx | 493 | 4096 |
| 1 | 500012 | sys | oceanbase | test2 | 493 | 4096 |
| 1 | 500013 | sys | oceanbase | __idx_500012_b_idx | 493 | 4096 |
| 1002 | 500008 | mysql001 | mysql | t2_m_lr | 8856 | 73728 |
| 1002 | 500051 | mysql001 | test | t1 | 1233 | 8192 |
+-----------+----------+-------------+---------------+---------------------+-------------+---------------+
10 rows in set
References
- View the total storage space occupied by each tenant across all nodes: oceanbase.CDB_OB_SPACE_USAGE
- View the storage space usage details of each tenant on each node: oceanbase.CDB_OB_SERVER_SPACE_USAGE
