select * from
(
select * from tableA
where cd1>'00' and cd2>'00'
) bb, tableB tb
where not exists
(
select npdt.no
from
(
select indexed, indexed2, code from
(
select indexed, indexed2, code from CodeA
union all
select indexed, indexed2, code from CodeB
)aa
group by indexed, indexed2, code
)aa
where aa.index1 = bb.index1
and aa.index2 = bb.index2
and aa.index3 = bb.index3
)and bb.no = tb.no
-----------------------------------
tableA : 4400만건
tableB : 14000건
CodeA + CodeB : 4500건
A테이블중 cd1>'00' and cd2>'00'중에
codeA, codeB 테이블의 코드값과 일치하지 않는 데이터중에
tableB의 넘버와 일치하는 경우를 뽑고자 하는데..
전체 건수가 너무 많아서...시간이..너무 많이 걸리더군요.
먼가 효과적인 다른방법은 없을까요?
|