내 쿼리를 최적화하려고하는데 내부 조인과 병합이 있습니다.sql, 쿼리 최적화 및 내부 조인?
조인 테이블은 하나의 정수 필드가있는 테이블로, 고유 키가 추가되었습니다.
내 where 절에 대해 세 필드의 키를 만들었습니다.
하지만 계획을 보면 여전히 테이블 스캔을 사용하고 있다고합니다.
어디로 잘못 가고 있습니까?
여기
select date(a.startdate, '+'||(b.n*a.interval)||' '||a.intervaltype) as due
from billsndeposits a
inner join util_nums b on date(a.startdate, '+'||(b.n*a.interval)||'
'||a.intervaltype) <= coalesce(a.enddate, date('2013-02-26'))
where not (intervaltype = 'once' or interval = 0) and factid = 1
order by due, pid;
저는 이것이 mysql이라고 가정합니다. –
사용중인 DB의 이름을 입력하십시오. 고려할 수있는 다른 옵션이있을 수 있습니다. –
'date (a.startdate, '+'|| (b.n * a.interval) || ''|| a.intervaltype)'이 방법이 효과가 있습니까? – Isaac