为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】: DM Database Server 64 V8
【操作系统】:uelc20
【CPU】: Huawei,Kunpeng 920
【问题描述】*:
查询SQL如下:
select * from fast_enterprise_source_item e where e.source_id in (
2018525164001566729,
2018525164001566731,
2018525164001566733,
2018525164001566735,
2018525164001566737
);
select * from fast_enterprise_source_item e where e.source_id in (
2018525164001566729,
2018525164001566731,
2018525164001566733,
2018525164001566735,
2018525164001566737,
2018525164001566738
);
目标数据表fast_enterprise_source_item数据量一千万,source_id有索引,当in中的值为5个时,响应很快,243ms,in中的值为6个时,响应很慢很慢116563ms,explain发现,5个的走了索引,6个的没走,强制指定索引后变快。
有没有什么配置可以设置,这个in的数量来控制底层判断逻辑
收集下统计信息

对fast_enterprise_source_item表进行更新统计信息试下
DBMS_STATS.GATHER_TABLE_STATS('模式名', 'fast_enterprise_source_item',null,100,TRUE,'FOR ALL COLUMNS SIZE AUTO');