-- 假设租户ID为100 (请替换为实际的租户ID)
SELECT
t.tenant_id,
d.database_name,
t.table_name,
t.data_size
FROM
gv$all_tables t
JOIN
gv$all_databases d ON t.tenant_id = d.tenant_id AND t.database_id = d.database_id
WHERE
t.tenant_id = 100 -- 替换为实际租户ID
ORDER BY
t.data_size DESC
LIMIT 20;
这个是3.0版本的,4.0版本查询报错:
SELECT t.tenant_id, d.database_name, t.table_name, t.data_size FROM gv$all_tables t JOIN gv$all_databases d ON t.tenant_id = d.tenant_id AND t.database_id = d.database_id WHERE t.tenant_id =1 ORDER BY t.data_size DESC LIMIT 20
-- 假设租户ID为100 (请替换为实际的租户ID)
SELECT
o.tenant_id,
d.database_name,
o.object_name AS table_name,
o.data_size
FROM
gv$all_objects o
JOIN
gv$all_databases d ON o.tenant_id = d.tenant_id AND o.data_object_id = d.database_id
WHERE
o.tenant_id = 100 -- 替换为实际租户ID
AND
o.object_type = 'TABLE'
ORDER BY
o.data_size DESC
LIMIT 20;
–查询语句
SELECT
d.tenant_id,
d.database_name,
t.table_name
FROM
CDB_TABLES t
JOIN
CDB_OB_DATABASES d ON t.CON_ID = d.tenant_id
where
d.tenant_id=1024
order by database_name desc limit 20;
–sql语句
select b.TABLE_SCHEMA,b.table_name,b.table_rows from oceanbase.CDB_OB_DATABASES a,information_schema.TABLES b where b.TABLE_SCHEMA=a.DATABASE_NAME and a.TENANT_ID=‘1024’ group by b.TABLE_SCHEMA,b.table_name,b.table_rows order by b.table_rows desc,b.TABLE_SCHEMA desc ,b.table_name desc limit 20;