Note
This view is available starting with V4.3.4.
Purpose
In Shared-Storage (SS) mode, the
CDB_OB_SPACE_USAGEview records the space occupied by different types of data for each tenant across various Endpoints and Paths.In Shared-Nothing (SN) mode, the
CDB_OB_SPACE_USAGEview records the total storage space occupied by each tenant across all nodes.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TENANT_ID | varchar(128) | NO | The tenant ID. |
| TENANT_NAME | varchar(128) | NO | The tenant name. |
| ENDPOINT | varchar(1024) | NO | The Endpoint of the shared storage, applicable only in SS mode. In SN mode, this field is NULL, indicating it is undefined. |
| PATH | varchar(1024) | NO | The Path of the shared storage, applicable only in SS mode. In SN mode, this field is NULL, indicating it is undefined. |
| SPACE_TYPE | varchar(11) | NO |
|
| USAGE_BYTES | decimal(42,0) | NO | The actual disk space occupied by the data, measured in bytes. |
Sample query
In SN mode, query the CDB_OB_SPACE_USAGE view to view the total disk space occupied by each tenant across all nodes.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_SPACE_USAGE LIMIT 10;
The query result is as follows:
+-----------+-------------+----------+------+-------------+-------------+
| TENANT_ID | TENANT_NAME | ENDPOINT | PATH | SPACE_TYPE | USAGE_BYTES |
+-----------+-------------+----------+------+-------------+-------------+
| 1 | sys | NULL | NULL | clog Data | 7680321279 |
| 1 | sys | NULL | NULL | Shared Data | 0 |
| 1 | sys | NULL | NULL | Local Data | 122265600 |
| 1002 | mysql001 | NULL | NULL | clog Data | 5925397177 |
| 1002 | mysql001 | NULL | NULL | Shared Data | 0 |
| 1002 | mysql001 | NULL | NULL | Local Data | 106221568 |
| 1004 | oracle001 | NULL | NULL | clog Data | 5970846734 |
| 1004 | oracle001 | NULL | NULL | Local Data | 90218496 |
| 1004 | oracle001 | NULL | NULL | Shared Data | 0 |
+-----------+-------------+----------+------+-------------+-------------+
9 rows in set
References
- View the sizes of all user tables (based on the Leader replica in a multi-replica environment) under all tenants: oceanbase.CDB_OB_TABLE_SPACE_USAGE
- View the detailed storage space usage of each tenant on each node: oceanbase.CDB_OB_SERVER_SPACE_USAGE
