728x90 반응형 Index2 인덱스 사용을 위한 가공된 컬럼 튜닝 방안 컬럼이 가동되면 인덱스 사용이 불가능해진다. 컬럼을 가공하지 않고 아래와 같이 조건절을 작성한다. 1. select * from Employee where substr(name,1,3) = 'LEE' ->튜닝 select * from Employee where name like 'LEE%' 2. select * from Employee where MonthPay * 12 = 50000000 ->튜닝 select * from Employee where MonthPay = 50000000 / 12 3. select * from Order where to_char(OrderDay,'yyyymmdd') = dt ->튜닝 select * from Order where OrderDay >= to_char(dt,'y.. 2020. 11. 1. BTree 인덱스 튜닝 B*Tree 인덱스를 사용하려면 인덱스의 선두 컬럼이 조건절에 적용되어야 한다. 그렇지 않을 경우 옵티마이저는 인덱스 전체를 스캔하거나 테이블 전체를 스캔하게 된다. 선두 컬럼이 조건절에 적용되더라도 인덱스 사용을 못하는 경우가 있는데 아래와 같다. 1. select * from Employee where substr(name, 1,3) = 'LEE' 2. select * from Employee where name 'LEE' 3. select * from Employee where name is not null 위 경우 정상적인 인덱스 범위 스캔이 불가능하지만 인덱스 사용자체가 불가능한건 아니라 Index Full Scan은 가능하다. SQL Server 서버는 is null 검색 시에도 인덱스를 사용.. 2020. 11. 1. 이전 1 다음 728x90 반응형