【 使用环境 】生产环境
【 OB or 其他组件 】ob
【 使用版本 】4251
【问题描述】DBA_INDEX_USAGE 关联dba_objects ,返回599条,再关联 information_schema.STATISTICS 后返回8900条
【复现路径】问题出现前后相关操作
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):
select t.owner, t.object_name,c.table_name from
(select b.object_name,b.owner from DBA_INDEX_USAGE a left join dba_objects b on a.object_id=b.object_id where a.owner not in(‘mysql’,‘test’,‘oceanbase’,‘information_schema’) and total_exec_count<2 and last_used <‘2025-06-09 15:49:00’) t join
( select table_schema, index_name,table_name from information_schema.STATISTICS group by table_schema, index_name,table_name) c on t.object_name=c.index_name and t.owner=c.table_schema
group by t.owner, t.object_name,c.table_name
SELECT t.owner, t.object_name, c.table_name
FROM (
SELECT b.object_name, b.owner
FROM DBA_INDEX_USAGE a
LEFT JOIN dba_objects b ON a.object_id = b.object_id
WHERE a.owner NOT IN ('mysql', 'test', 'oceanbase', 'information_schema')
AND total_exec_count < 2
AND last_used < '2025-06-09 15:49:00'
) t
JOIN (
SELECT table_schema, index_name, table_name
FROM information_schema.STATISTICS
WHERE table_schema NOT IN ('mysql', 'test', 'oceanbase', 'information_schema')
) c
ON t.object_name = c.index_name AND t.owner = c.table_schema
GROUP BY t.owner, t.object_name, c.table_name;