oracle优化方法
1、like优化
原sql:
select * from student;
select name from student where name like 'li%';
优化后:
select name from student where instr(name,'li') = 1;
2、in优化
原sql:
select * from student where ClassCode in ('1011','1012');
优化后:
select * from student where ClassCode = '1011'
union all
select * from student where ClassCode = '1012'
3、子查询优化
原sql:
select name from student where ClassCode = (select ClassCode from teacher where name = 'tom');
优化后:
select s.name from student s left join teacher t on s.ClasCode = t.ClassCode where t.name = 'tom';
未完待续;