Note
This view is available starting with V4.3.5.
Purpose
This view displays the sizes of all user tables (based on the leader replica in a multi-replica environment) in the current tenant.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TABLE_ID | bigint(20) | NO | The ID of the table. |
| DATABASE_NAME | varchar(128) | NO | The name of the database. |
| TABLE_NAME | varchar(256) | NO | The name of the table. |
| OCCUPY_SIZE | decimal(42,0) | NO | The size of the data after compression is written to disk, in bytes. |
| REQUIRED_SIZE | decimal(42,0) | NO | The actual disk space occupied by the data after compression is written to disk, in bytes. |
Sample query
In SN mode, query the sizes of all user tables in the current user tenant.
obclient [test]> SELECT * FROM SYS.DBA_OB_TABLE_SPACE_USAGE WHERE ROWNUM <= 3;
The query result is as follows:
+----------+---------------+--------------------------------+-------------+---------------+
| TABLE_ID | DATABASE_NAME | TABLE_NAME | OCCUPY_SIZE | REQUIRED_SIZE |
+----------+---------------+--------------------------------+-------------+---------------+
| 500011 | test | wide_table_row_storage2 | 4495925120 | 4613763072 |
| 500012 | test | wide_table_column_storage2 | 3915023145 | 4195397632 |
| 500014 | test | wide_table_row_column_storage2 | 8410964107 | 9805275136 |
+----------+---------------+--------------------------------+-------------+---------------+
3 rows in set
References
- Query the sizes of all user tables (based on the leader replica in a multi-replica environment) in all tenants: oceanbase.CDB_OB_TABLE_SPACE_USAGE
- Query the total storage space occupied by each tenant across all nodes: oceanbase.CDB_OB_SPACE_USAGE
- Query the storage space usage of each tenant on each node: oceanbase.CDB_OB_SERVER_SPACE_USAGE
