본문 바로가기
DataBase

인덱스 사용을 위한 가공된 컬럼 튜닝 방안

by 따봉이 2020. 11. 1.
728x90
반응형

컬럼이 가동되면 인덱스 사용이 불가능해진다.

컬럼을 가공하지 않고 아래와 같이 조건절을 작성한다. 

 

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,'yyyymmdd')

  and   OrderDay < to_date(dt,'yyyymmdd') + 1

 

 

2.

select *

from  Employee

where  Age ||  Rank = '30MANAGER'

 

->튜닝

select *

from Employee

where Age = '30'

  AND Rank = 'MANAGER'

 

 

 

 

 

 

 

 

728x90
반응형

'DataBase' 카테고리의 다른 글

MSSQL의 Merge 로 데이터 병합처리  (0) 2020.11.04
WHERE INDEXを使用してみましょう  (0) 2020.11.01
인덱스 Select 시 조건절 데이터타입  (0) 2020.11.01
BTree 인덱스 튜닝  (0) 2020.11.01
Oracle/MSSQL SELECT 시 NOLOCK  (0) 2020.10.29

댓글