SELECT
a.svr_ip,
a.svr_port,
b.tenant_id,
b.table_id,
count(a.tablet_id) as tablet_count,
sum(a.size) as size
FROM
__all_virtual_table_mgr a
INNER JOIN __all_virtual_tablet_to_ls b ON b.tenant_id = a.tenant_id
AND b.ls_id = a.ls_id
AND b.tablet_id = a.tablet_id
WHERE
table_type != 0
and b.table_id in (
select
table_id
from
__all_virtual_table
where
table_name = $table_name
)
group by
a.svr_ip,
a.svr_port,
b.tenant_id,
b.table_id;