首批通过分布式安全可靠测评,为关键业务系统打造
分区统计
更新时间:2026-05-21 09:16
本文列出 OceanBase 数据库中的 Server、Zone 上的分区统计 SQL 语句。
适用版本
OceanBase 数据库 V2.x、V3.x 版本。
统计每个 Server 上租户分区数
SELECT a.*, b.tenant_name, c.zone FROM (
SELECT COUNT(1) cnt, svr_ip, tenant_id FROM __all_virtual_partition_info GROUP BY svr_ip, tenant_id ORDER BY 1 desc
) a,
__all_tenant b,
__all_server c
WHERE
a.tenant_id = b.tenant_id
AND c.svr_ip = a.svr_ip
order by
cnt desc;
统计每个 Zone 的分区数
select zone,p.svr_ip,count(*) as partition_count from __all_virtual_partition_info p
join __all_server s on p.svr_ip=s.svr_ip group by zone,p.svr_ip order by zone,p.svr_ip
查看分区限制
select * from oceanbase.__all_virtual_sys_parameter_stat where name like '%partition_cnt%'
OBServer 的最大分区限制
建议值为 5W。
OBServer 分区总数受隐藏配置项 _max_partition_cnt_per_server,V2.2.77 默认值为 10W,V3.2.3 默认值为 50W,但是超过 5W 会存在稳定性问题,后续需要对所有部署的集群修改该配置。