select /*+index(상담_x3)*/count(distinct 고객번호)
from 상담 --1000만건
where 상담일자<to_char(sysdate, 'yyyymmdd') --거의 대부분 상담일자 조건절 만족
and  클레임상품명 is not null --1000만건 중 200000건만 클레임상품명 not null
;

select /*+index(상담_x3)*/count(distinct 고객번호)
from 상담 --1000만건
where 상담일자<to_char(sysdate, 'yyyymmdd') --거의 대부분 상담일자 조건절 만족
and  클레임상품명>=chr(0) --1000만건 중 200000건만 클레임상품명 not null
;

select /*+index(클레임상품번호, 상담일자) */ count(distinct 고객번호)
from 상담 --1000만건
where 상담일자<to_char(sysdate, 'yyyymmdd') --거의 대부분 상담일자 조건절 만족
and 클레임상품번호 >=  (select min(클레임상품번호) from 상담); --1000만건 중 200000건만 클레임상품명 not null
;

select /*+use_concat */ count(distinct 고객번호)
from 상담 --1000만건
where 상담일자<to_char(sysdate, 'yyyymmdd') --거의 대부분 상담일자 조건절 만족
and 클레임상품번호 >=0 or 클레임상품번호 < 0; --1000만건 중 200000건만 클레임상품명 not null

;
select chr(0) from dual;

반응형
Posted by cocon