오라클 딕셔너리 뷰 끼리의 조인을 통해 원하는 데이터를 추출하는 내용인데.... 조회속도가 너무 느려서 문제입니다.
조회속도가 dba, all 뷰 별로도 속도차이가 너무많이 나고, 심하게는 2분이 지나도 조회결과가 나타나지 않고 서버 환경별로 너무 심하게 차이가 나는지라.. ( 11g 서버에서는 빠르지만, oracle 9 버전 에서는 느리고 ) 도저히 어떻게 해줘야 공통적으로 성능이 저하되지 않고, 빠르게 조회가 가능할지 여쭤봅니다.
우선 문제 쿼리입니다. ( 4조인 입니다 )
select b.table_name
, a.index_owner
, a.index_name
, a.partition_name
, a.compression
, a.tablespace_name
, a.pct_free
, a.ini_trans
, a.max_trans
, a.initial_extent
, a.next_extent
, a.min_extent
, a.max_extent
, a.pct_increase
, a.freelists
, a.freelist_groups
, a.buffer_pool
, a.flash_cache
, a.cell_flash_cache
, a.logging
, decode(c.partitioning_type,'range','0','hash','1','list','2','3') partitioning_type
, a.high_value
, o.generated
from sys.dba_ind_partitions a
left join sys.dba_objects o
on a.index_owner = o.owner
and a.partition_name = o.subobject_name
and o.generated = 'n'
left join sys.dba_indexes b
on a.index_owner = b.owner
and a.index_name = b.index_name
and o.object_name = b.table_name
left join sys.dba_part_indexes c
on a.index_owner = c.owner
and a.index_name = c.index_name
where 1=1
and b.table_owner = :owner and b.table_name = :b00
order by b.table_name,a.index_owner,a.index_name,a.partition_position
1. 특정 테이블에 제가 임의로 인덱스를 삽입 할수가 없는 상황입니다.
2. 뷰 마다 조회해야할 데이터가 하나씩은 다있어서 뺄수가 없습니다.
3. DB이론에 나온것처럼 바인드변수 위치를 from 쪽에 위치시켜, 조인데이터를 최소화 시키는것도 해보았지만 도저히 조회속도가 줄어들지를 않습니다.
조인 구조를 진짜 이방법 저방법 다 돌려가며 써보았지만, 정말 개선이 안됩니다 ㅠㅠ 혹시 도와주실수 있으실까요. |