在PL/SQL developer中看一下下面语句的执行计划,看没有用到你建的索引 select * from table1 where yhmc like '%张三丰%' order by dhhm
你的语句(like '%张三丰%' )执行时应该是不使用索引的
yhmc和DHHM字段都分别独立建立了索引 为什么不合并为一个index DHHM为索引的前缀
to l2g32003(T2-X) : 我也已经建立了一个yhmc和DHHM合并的索引 DHHM 为1,yhmc为2
以下情况不使用索引 select * from tablename where id+0=1 where user_name||''= 'smith' where to_number(字段)=4 where user_name like '%D' where user_name like 'D%' where user_name like '%D%' where user_name like 'D%D' where to_char(字段)='k' where nvl(字段,'0')='3' where to_date(字段) ...... --以上排除建了函数索引的情况,如果想用索引则建立函数索引.两查询时间相差很多是因为排序的缘故,数据量大查询时间就会相差很多,
select * from table1 where yhmc like '%张三丰%' order by dhhm
我也已经建立了一个yhmc和DHHM合并的索引 DHHM 为1,yhmc为2
select * from tablename where id+0=1
where user_name||''= 'smith'
where to_number(字段)=4
where user_name like '%D'
where user_name like 'D%'
where user_name like '%D%'
where user_name like 'D%D'
where to_char(字段)='k'
where nvl(字段,'0')='3'
where to_date(字段)
......
--以上排除建了函数索引的情况,如果想用索引则建立函数索引.两查询时间相差很多是因为排序的缘故,数据量大查询时间就会相差很多,
楼主与archai是同一个人?