아래의 SQL 쿼리 속도를 향상시킬 수 있습니까?SQL 최적화 (그룹화 및 최대)
select
max(xtrid) as xtrid
, jid
from jpltab jl
inner join rb_cust u
on jl.custid = u.custid
where jl.tpe = 'Y'
and jl.jid in (51, 52, 53, 54, 55)
and u.org = 'INVCE'
group by jid
order by xtrid desc;
감사
인덱스 추가 .... –
실행 계획을 포함시킬 수 있습니까? – VDK
'Where' 절의'jl.jid'가 연속적인 숫자를 가지고 있으므로'IN (51, 52, 53, 54, 55) '대신에'51와 55 사이'로 변경하십시오. 이렇게하면 더 나은 성능을 얻을 수 있습니다. 여기를 참조하십시오 ... https://stackoverflow.com/questions/3308280/is-there-a-performance-difference-between-between-in-with-mysql-or-in-sql-in –