Note
This view was introduced in OceanBase Database V4.3.5.
Purpose
The DBA_OB_TABLE_SPACE_USAGE view is used to display the size of all user tables under the current tenant based on the leader replica in a multi-replica environment.
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 amount of data written to disk after table compression, in bytes. |
| REQUIRED_SIZE | decimal(42,0) | NO | The actual disk space occupied by the data written to disk after table compression, in bytes. |
Sample query
In Shared-Nothing mode, a user tenant queries the sizes of all user tables in the 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