일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- create role
- oracle
- 오라클
- oracle supplemental
- oracle dba_profile password_life_time
- ORA-00020
- ora-39083 ora-00439
- oracle 테스트 데이터
- oracle install
- oracle system lock
- SSMS
- supplemental log 활성화
- partition_options=merge
- Oracle RAC
- oracleasm
- ora-28002: the password will expire within 7 days
- oracle pdb
- mssql database 삭제
- sql user 생성
- ora-00439: feature not enabled: partitioning
- oracle tde
- oracle 파티션 datapump
- oracle SCN
- oracle awr
- Oracle Database
- oracle role 삭제
- MSSQL
- SQL Server
- oracle account_status expired
- oracle datapump
Archives
- Today
- Total
신문지한장
[SQL튜닝] 실행계획과 비용 본문
1. 테스트용 테이블 생성
create table t
as
select d.no, e.*
from scott.emp e, (select rownum no from dual connect by level <= 1000 )d;
2. 테스트용 인덱스 생성
create index t_x01 on t(deptno,no);
create index t_x02 on t(deptno, job, no);
3. T테이블에 통계정보 수집
exec dbms_stats.gather_table_stats(user, 't');
4. AutoTrace 활성화 후 SQL 실행시 실행계획 확인가능
select * from t
where deptno=10
and no=1;
옵티마이저가 선택한 인덱스 T_X01, T_X02를 선택할 수있고 테이블을 선택할 수 있는데 T_X01을 선택한 이유는 Cost가 2로 표시됨
5. T_X02로 강제 힌트 줘서 사용함
set autotrace traceonly exp;
select /*+ index( t t_x02) */ * from t
where deptno=10
and no=1;
Cost가 7로 올라감
6. full scan 할 경우 Cost가 29로 올라감
select /*+ full(t) */* from t
where deptno=10
and no=1;
'Oracle > sql&script' 카테고리의 다른 글
[SQL] 세그먼트에 할당된 익스텐트 목록을 조회하는 방법 (0) | 2024.08.06 |
---|---|
[SQL튜닝] 옵티마이저 힌트 사용 방법 (0) | 2024.08.06 |
logging과 nologging (0) | 2024.08.06 |
BasicFile 과 SecureFile (0) | 2024.08.06 |
oracle glogin (0) | 2024.04.18 |