【 使用环境 】测试环境
【 OB or 其他组件 】OceanBase‑ce,obclient
【 使用版本 】4.2.5‑ce
【问题描述】MySQL 模式租户,执行一条带 local 本地索引的 update 语句,执行计划走全表扫描,没有使用已创建的 local 索引,SQL 执行耗时很高。
【复现路径】
- 创建分区表,按 hash (c1) 分为 4 个分区
- 在 c2 字段建立 local 本地索引
- 执行 update t set c3=‘test’ where c2=100;
- explain 查看执行计划,算子为 TABLE FULL SCAN,没有走 TABLE RANGE SCAN 索引扫描。
create table t(c1 int,c2 int,c3 varchar(100)) partition by hash(c1) partitions 4;
create index idx_t_c2 on t(c2) local;
update t set c3='test' where c2=100;
explain update t set c3='test' where c2=100;