OceanBase AI Database supports viewing the disk space usage of tenants and tables through views.
View disk space usage of a tenant
Log in to the
systenant of the cluster as therootuser.Note that you must specify the appropriate parameters in the following example command based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following statement to view the disk space usage of the tenant on each node.
In the sys tenant, execute the following statement to view the disk space usage of different components of the
mysql001tenant on each node:obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_SERVER_SPACE_USAGE WHERE TENANT_NAME='mysql001' ;The query result is as follows:
+-----------+-------------+----------------+-------------+------------+------------+-------------+ | TENANT_ID | TENANT_NAME | SERVER_IP | SERVER_PORT | SPACE_TYPE | DATA_BYTES | USAGE_BYTES | +-----------+-------------+----------------+-------------+------------+------------+-------------+ | 1002 | mysql001 | xx.xx.xx.xx | 2882 | clog Data | 5898749661 | 5898749661 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Index Data | 2793 | 24576 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Meta Data | 28184576 | 28184576 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | slog Data | 26112000 | 26112000 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Table Data | 25268 | 6438912 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Tmp Data | 0 | 0 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | clog Data | 3348203904 | 3348203904 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Index Data | 3936 | 32768 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Meta Data | 25452544 | 25452544 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | slog Data | 39931904 | 39931904 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Table Data | 8056455 | 8736768 | | 1002 | mysql001 | xx.xx.xx.xx | 2882 | Tmp Data | 0 | 0 | +-----------+-------------+----------------+-------------+------------+------------+-------------+ 12 rows in setIn the returned result:
SPACE_TYPE: The type of data. Valid values:Table Data: Data of all partitions in all primary tables, including LOB partitions.Index Data: Data of all partitions in all index tables.Meta Data: All metadata.Tmp Data: Temporary files.clog Data: Total size of clogs on the current node.slog Data: Total size of slogs on the current node.
DATA_BYTES: The size of the data content, in bytes.USAGE_BYTES: The disk space actually occupied, in bytes.
View disk space usage of a table
Log in to the database as the tenant administrator of the
systenant or a user tenant.Note
The administrator of a user tenant is the
rootuser.Note that you must specify the appropriate parameters in the following example command based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following statements to view the disk space usage of table data.
System tenant
In the system tenant, query the disk space usage of table
t1under tenantmysql001. The statement is as follows:obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_TABLE_SPACE_USAGE WHERE TENANT_NAME='mysql001' AND TABLE_NAME='t1';The query result is as follows:
+-----------+----------+-------------+---------------+---------------------+-------------+---------------+ | TENANT_ID | TABLE_ID | TENANT_NAME | DATABASE_NAME | TABLE_NAME | OCCUPY_SIZE | REQUIRED_SIZE | +-----------+----------+-------------+---------------+---------------------+-------------+---------------+ | 1002 | 500051 | mysql001 | test | t1 | 1233 | 8192 | +-----------+----------+-------------+---------------+---------------------+-------------+---------------+ 1 row in setUser tenant
Query the disk space usage of each table under the current tenant. The statement is as follows:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TABLE_SPACE_USAGE;An example of 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 setIn the returned result:
OCCUPY_SIZE: The amount of data compacted and stored on disk for the table, in bytes.REQUIRED_SIZE: The actual disk space occupied by the compacted data on disk, in bytes.
From the returned result, you can also calculate the disk space utilization by using
OCCUPY_SIZE/REQUIRED_SIZE.