查询优化问题?实例
有一表:
tb_list(c_Local_Type,c_No,c_CallNo,dt_Date,i_Time,c_Long_Type,c_VID,c_CID)
记录条数有1亿多条
一般的查询有:
1.
select sum(i_Time)
from tb_list
where c_Local_Type='本地'
and c_No='123456789'
and c_Long_Type='长'
and c_VID='1'
and c_CID='1'
2.
SELECT c_Local_Type,c_Long_Type,i_Time
FROM tb_list
WHERE (c_Local_Type <> '免')
and (c_VPMN_ID <> '1')
and (c_Call_ID <> '1')
and (c_MobileNo=@c_MobileNo)
ORDER BY dt_Call_Date
这是一个游标使用的select语句来的
c_Local_Type,c_Long_Type 字段取值大多都是相同的,
c_No 的取值大概有17W到18W个左右
c_VPMN_ID,c_Call_ID取值只有两个!
请问应该怎样加索引?
就以上查询语句应该怎样加?
针对这个表的查询,更新还有很多其他的!