如下例子,Dim_Material_Info有6万条记录,建了索引IDX_DIM_MATERIAL_INFO_1:
但不知道什么原因,没有用上索引IDX_DIM_MATERIAL_INFO_1,造成查询速度很慢。
改造后的查询sql如下,强制使用索引:
select /*+index(x IDX_DIM_MATERIAL_INFO_1)*/a.*
From Newods.cli_pay a
inner join Dim_Material_Info x on a.item_code = x.material_code
Where a.fee_date >= sysdate - 1;
语法说明:
/*+index(x IDX_DIM_MATERIAL_INFO_1)*/
x:表的别名
IDX_DIM_MATERIAL_INFO_1:索引名
标签:INFO,DIM,code,IDX,MATERIAL,索引,oracle,强制 From: https://www.cnblogs.com/wwzd/p/17816168.html