扩varchar字段进度与空间评估

20250109.txt (14.9 KB)
附件参数。 100GB的表冗余600G ? 我们还有6亿多的表也需要变更,这无法评估磁盘量,也不能盲目扩多少呀? 所以这个变更就是由于磁盘原因变更失败?

这600GB 还是没执行成功使用的量。gv$session_longops 实际才扫描rows 5千万,这样算需要至少一个节点需要扩3T的盘了。

memory_limit_percentage 90% 可以有类似文档看下原理性的原因嘛?或者具体的大表列变更 ,像磁盘量这种影响因素评估计算方式,我们也好提前预估。目前无法变更业务都卡着。

这个值就是预估的量
image
我看你们设置的datafile_disk_percentage和datafile_size没有设置大小 是按照这个比例走的


你可以datafile_size或者datafile_disk_percentage 在设置 datafile_next 自动增长 在设置一个最大值 这样也是可以 因为ddl操作 排序对临时空间的膨胀 需要磁盘更大的磁盘 磁盘不能扩容会导致修改失败

这个预估的量单位是?ddl操作 排序对临时空间的膨胀, datafile_maxsize 的设置 要大于上面的预估量吧?datafile_next 设置多大合适呢? 临时空间的膨胀 有大概膨胀比例嘛? 后续版本有规避这个问题嘛?

单位是字节

集群 server 级资源分配情况

select zone,concat(SVR_IP,’:’,SVR_PORT) observer,
cpu_capacity_max cpu_total,cpu_assigned_max cpu_assigned,
cpu_capacity-cpu_assigned_max as cpu_free,
round(memory_limit/1024/1024/1024,2) as memory_total,
round((memory_limit-mem_capacity)/1024/1024/1024,2) as system_memory,
round(mem_assigned/1024/1024/1024,2) as mem_assigned,
round((mem_capacity-mem_assigned)/1024/1024/1024,2) as memory_free,
round(log_disk_capacity/1024/1024/1024,2) as log_disk_capacity,
round(log_disk_assigned/1024/1024/1024,2) as log_disk_assigned,
round((log_disk_capacity-log_disk_assigned)/1024/1024/1024,2) as log_disk_free,
round((data_disk_capacity/1024/1024/1024),2) as data_disk,
round((data_disk_in_use/1024/1024/1024),2) as data_disk_used,
round((data_disk_capacity-data_disk_in_use)/1024/1024/1024,2) as data_disk_free
from oceanbase.gv$ob_servers;


分配情况

预估需要2.13TB ?这??? 底层在做那些操作?怎么需要20多倍的临时空间?

你上面的统计没有计算索引占用 只是表的实际占用磁盘大小

统计租户的大小

SELECT t.tenant_name,
round(sum(t2.data_size)/1024/1024/1024,2) as data_size_gb,
round(sum(t2.required_size)/1024/1024/1024,2) as required_size_gb
FROM oceanbase.dba_ob_tenants t,oceanbase.cdb_ob_table_locations t1,cdb_ob_tablet_replicas t2
WHERE t.tenant_id=t1.tenant_id and t1.svr_ip=t2.svr_ip and t1.tenant_id=t2.tenant_id and t1.ls_id=t2.ls_id and t1.tablet_id=t2.tablet_id
group by t.tenant_name
order by 3 desc;

image
租户大小。加上索引最多200G 吧。膨胀10倍? 有SQl查嘛索引以及表的4.x 版本?

ob4.3之前的膨胀超过5倍了 不过4.3以后优化很多
select tenant_id from __all_tenant where tenant_name = ‘租户名’;
select table_id, table_name from __all_virtual_table where table_name = ‘表名’ and tenant_id = ‘租户id’; --查询出表名和索引名
select t1.table_name,
round(sum(t2.data_size)/1024/1024/1024,2) as data_size_gb,
round(sum(t2.required_size)/1024/1024/1024,2) as required_size_gb
from dba_ob_tenants t,cdb_ob_table_locations t1,cdb_ob_tablet_replicas t2
where t.tenant_id=t1.tenant_id
and t1.svr_ip=t2.svr_ip
and t1.tenant_id=t2.tenant_id
and t1.ls_id=t2.ls_id
and t1.tablet_id=t2.tablet_id
and t1.role=‘leader’
and t.tenant_name=‘test1’
and t1.database_name=‘sbtest’
and t1.table_name=‘sbtest1’
group by t1.table_name
order by 3 desc; --根据这个语句可以查出表的大小和索引大小 指定表名 是表的大小 指定索引名是索引的大小

图片
180G

确实是膨是挺大的 不过4.3版本以后优化好了很多 建议先扩容吧 要不然修改字段类型的大小 会报磁盘不够的错误