大家好,又见面了,我是你们的朋友全栈君
oracle之优化is null语句
一:is null的优化
方法:通过nvl(字段,j)=j的方式,将字段中为空的数据转化为j,从而正常使用索引。...具体实现条件则是:i is null j = nvl(i,j);
注意:使用时必须要确保字段的数据不包含j,例如:(age,15)=15,此时有可能age
内容是15,此时不可以,j的值要变换...不存在等于1的数据时等价于
–select * from student t where t.age is null;
–添加索引的方式
create index idx_age_x on tab_i(...decode(age,null,1));
select * from student t where decode(t.age,null,1)=1;
二:is not null的优化
方法:结果集不包含...select * from student t where not exists
(select 1 form student s where 1=nvl(s.age,1));
–11g版本后not in和not