메뉴 여닫기
개인 메뉴 토글
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

오라클 lob테이블 성능 테스트: 두 판 사이의 차이

DB스터디
편집 요약 없음
편집 요약 없음
65번째 줄: 65번째 줄:
|제목=''' <big> 핵심사항 </big>'''
|제목=''' <big> 핵심사항 </big>'''
|내용= ''' <big>LOB 관련 핵심 통계  (SecureFile이면 securefile* 계열도 반드시 확인):</big>'''
|내용= ''' <big>LOB 관련 핵심 통계  (SecureFile이면 securefile* 계열도 반드시 확인):</big>'''
- `physical reads direct (lob)` / `physical writes direct (lob)` — LOB direct I/O 횟수
::::- `physical reads direct (lob)` / `physical writes direct (lob)` — LOB direct I/O 횟수
- `physical read total bytes` / `physical write total bytes` — 실제 처리 byte
::::- `physical read total bytes` / `physical write total bytes` — 실제 처리 byte
- `securefile direct read bytes` / `securefile direct write bytes` — SecureFile LOB 전용
::::- `securefile direct read bytes` / `securefile direct write bytes` — SecureFile LOB 전용
- `securefile number of non-transformed blocks` — 압축/암호화 미적용 블록 확인용
::::- '''securefile number of non-transformed blocks''' — 압축/암호화 미적용 블록 확인용
}}
}}



2026년 8월 12일 (수) 15:47 판

오라클 lob테이블 성능 테스트

  • CLOB 테이블 성능 테스트는 일반 테이블과 달리 LOB I/O가 별도 경로(direct path read/write lob)로 처리되기 때문에 일반 v$sqlarea 통계만으로는 부족

실무에서 사용하는 3단계 접근법

1) 세션 레벨 Before/After 스냅샷 (가장 실용적)
  • 세션 통계(v$mystat)와 대기 이벤트(v$session_event)를 테스트 전후로 스냅샷 떠서 차이(delta)를 구하는 방식입니다. 오버헤드가 거의 없어서 반복 테스트에 적합합니다.

-- 로그 테이블
CREATE TABLE clob_perf_test_log (
  test_id         NUMBER,
  test_name       VARCHAR2(100),
  stat_name       VARCHAR2(64),
  stat_type       VARCHAR2(10),  -- 'STAT' or 'EVENT'
  delta_value     NUMBER,
  elapsed_sec     NUMBER,
  created_at      TIMESTAMP DEFAULT SYSTIMESTAMP
);

CREATE SEQUENCE clob_perf_test_seq;

-- 테스트 전
CREATE GLOBAL TEMPORARY TABLE gt_stat_before AS
SELECT statistic# id, name, value FROM v$mystat s JOIN v$statname n USING(statistic#) WHERE 1=0;

INSERT INTO gt_stat_before
SELECT s.statistic#, n.name, s.value
FROM v$mystat s JOIN v$statname n ON s.statistic# = n.statistic#
WHERE n.name IN (
  'physical reads direct (lob)',
  'physical writes direct (lob)',
  'physical read total bytes',
  'physical write total bytes',
  'securefile direct read bytes',
  'securefile direct write bytes',
  'session logical reads',
  'consistent gets',
  'db block gets',
  'physical reads',
  'redo size',
  'CPU used by this session',
  'DB time'
);

-- ★ 여기서 CLOB 테스트 SQL 실행 ★

-- 테스트 후 delta 저장


INSERT INTO clob_perf_test_log (test_id, test_name, stat_name, stat_type, delta_value)
SELECT clob_perf_test_seq.NEXTVAL, 'clob_insert_test', n.name, 'STAT',
       s.value - b.value
FROM v$mystat s
JOIN v$statname n ON s.statistic# = n.statistic#
JOIN gt_stat_before b ON b.id = s.statistic#;


  vpn_key 핵심사항

  playlist_add_check LOB 관련 핵심 통계 (SecureFile이면 securefile* 계열도 반드시 확인):

- `physical reads direct (lob)` / `physical writes direct (lob)` — LOB direct I/O 횟수
- `physical read total bytes` / `physical write total bytes` — 실제 처리 byte
- `securefile direct read bytes` / `securefile direct write bytes` — SecureFile LOB 전용
- securefile number of non-transformed blocks — 압축/암호화 미적용 블록 확인용


2) 대기 이벤트(Wait Event) 수집

-- v$session_event 스냅샷도 동일하게 before/after diff
SELECT event, total_waits, time_waited_micro
FROM v$session_event
WHERE sid = SYS_CONTEXT('USERENV','SID')
  AND event IN ('direct path read (lob)','direct path write (lob)',
                'direct path read','direct path write',
                'db file sequential read','db file scattered read',
                'read by other session');
  • CLOB이 크면 `direct path read (lob)` / `direct path write (lob)`가 지배적으로 나타나는지가 핵심 관찰 포인트입니다.
3) 정밀 분석이 필요하면 10046 트레이스

EXEC DBMS_MONITOR.SESSION_TRACE_ENABLE(waits=>TRUE, binds=>FALSE);
-- 테스트 실행
EXEC DBMS_MONITOR.SESSION_TRACE_DISABLE;
→ tkprof로 파싱하면 SQL별 elapsed/cpu/disk/query/current, wait event별 시간까지 다 나옵니다.
→ 반복 자동화보다는 특정 케이스 딥다이브용으로 적합합니다.


(정리) lob테이블 성능 개선 방법
목적 방법
반복 자동화, 오버헤드 최소 v$mystat/v$session_event before-after diff (Python 래퍼)
CLOB 처리 byte/IO 정확히 `physical reads/writes direct (lob)`, `*_total_bytes`, SecureFile이면 `securefile direct read/write bytes`
특정 SQL 딥다이브 DBMS_MONITOR 10046 trace + tkprof
SQL 단위 elapsed/cpu v$sql (module/action 태깅 후 SQL_ID로 조회)


(확인이 필요한 부분) 테스트 대상 CLOB이 **BasicFile인지 SecureFile인지**에 따라 관찰해야 할 통계 이름과 direct path 발생 패턴이 다름.