ePapyrus PDF Document

Similar documents
Jerry Held


ๆญฏsql_tuning2

๊ธฐ์ˆ ๋…ธํŠธ 49 ํšŒ SQL PLAN MANAGEMENT Author ์œค๋ณ‘๊ธธ๊ณผ์žฅ Creation Date Last Updated Version 1.0 Copyright(C) 2009 Goodus Inc. All Rights Reserved

SQL PLAN MANAGEMENT ํ™œ์šฉ ์—‘์…ˆ์ปจ์„คํŒ…๋ณธ๋ถ€ /DB ์ปจ์„คํŒ…ํŒ€์žฅ์ •๋ฏผ ๊ฐœ์š” ์˜ค๋ผํด์€๋น„๋กฏํ•œ๋งŽ์€๊ด€๊ณ„ํ˜• DBMS ์—์„œ๋Š”์‚ฌ์šฉ์ž์˜ SQL ์งˆ์˜๋ฅผํšจ์œจ์ ์œผ๋กœ์ฒ˜๋ฆฌํ•˜๊ธฐ์œ„ํ•ด์˜ตํ‹ฐ๋งˆ์ด์ €๋ฅผ์‚ฌ์šฉํ•˜๊ณ ์žˆ๋‹ค. ์˜ตํ‹ฐ๋งˆ์ด์ €๋Š”์œ ์ €๊ฐ€์ˆ˜ํ–‰ํ•˜๋Š” SQL ์„๋ฐ›์•„์‹คํ–‰๊ณ„ํš์„์ƒ์„ฑํ•˜๊ณ , ์‹ค์ œ SQL ์€์ด์‹คํ–‰๊ณ„ํš์„

SQL Tuning Business Development DB

๋ชฉ์ฐจ BUG offline replicator ์—์„œ์œ ํšจํ•˜์ง€์•Š์€๋กœ๊ทธ๋ฅผ์ฝ์„๊ฒฝ์šฐ๋น„์ •์ƒ์ข…๋ฃŒํ• ์ˆ˜์žˆ๋‹ค... 3 BUG ๊ฐ partition ์ด์„œ๋กœ๋‹ค๋ฅธ tablespace ๋ฅผ๊ฐ€์ง€๊ณ , column type ์ด CLOB ์ด๋ฉฐ, ํ•ด๋‹น table ์„ truncate

13์ฃผ-14์ฃผproc.PDF

10.ppt

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

๋ชฉ์ฐจ BUG ๋ฌธ๋ฒ•์—๋งž์ง€์•Š๋Š”์งˆ์˜๋ฌธ์ˆ˜ํ–‰์‹œ, ์—๋Ÿฌ๋ฉ”์‹œ์ง€์—์งˆ์˜๋ฌธ์˜์ผ๋ถ€๋งŒ๋ณด์—ฌ์ฃผ๋Š”๋ฌธ์ œ๋ฅผ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค... 3 BUG ROUND, TRUNC ํ•จ์ˆ˜์—์„œ DATE ํฌ๋งท IW ๋ฅผ์ถ”๊ฐ€์ง€์›ํ•ฉ๋‹ˆ๋‹ค... 5 BUG ROLLUP/CUBE ์ ˆ์„ํฌํ•จํ•˜๋Š”์งˆ์˜๋Š” SUBQUE

SQL Tuning Business Development DB SQL - -SQL -SQL

Bind Peeking ํ•œ๊ณ„์—๋”ฐ๋ฅธ Adaptive Cursor Sharing ๋“ฑ์žฅ ์—‘์…ˆ์ปจ์„คํŒ…๋ณธ๋ถ€ /DB ์ปจ์„คํŒ…ํŒ€๊น€์ฒ ํ™˜ Bind Peeking ์˜ํ•œ๊ณ„ SQL ์ด์ตœ์ดˆ์‹คํ–‰๋˜๋ฉด 3 ๋‹จ๊ณ„์˜๊ณผ์ •์„๊ฑฐ์น˜๊ฒŒ๋˜๋Š”๋ฐ Parsing ๋‹จ๊ณ„๋ฅผ๊ฑฐ์ณ Execute ํ•˜๊ณ  Fetch ์˜๊ณผ์ •์„ํ†ตํ•ด๋ฐ์ดํ„ฐ

Result Cache ๋™์ž‘์›๋ฆฌ๋ฐํ™œ์šฉ๋ฐฉ์•ˆ ์—‘์…ˆ์ปจ์„คํŒ…๋ณธ๋ถ€ /DB ์ปจ์„คํŒ…ํŒ€๊น€์ฒ ํ™˜ ๊ฐœ์š” ORACLE DBMS ๋ฅผ์‚ฌ์šฉํ•˜๋Š”์‹œ์Šคํ…œ์—์„œ QUERY ์„ฑ๋Šฅ์€๋ฌด์—‡๋ณด๋‹ค์ค‘์š”ํ•œ์š”์†Œ์ค‘ํ•˜๋‚˜์ด๋ฉฐ๊ทธ ์„ฑ๋Šฅ๊ณผ์ง์ ‘์ ์ธ๊ด€๋ จ์ด์žˆ๋Š”๊ฒƒ์ด I/O ์ด๋‹ค. ๋งŽ์€๊ฑด์ˆ˜๋ฅผ ACCESS ํ•ด์•ผ๋งŒ์›ํ•˜๋Š”๊ฒฐ๊ณผ๊ฐ’์„์–ป์„์ˆ˜์žˆ๋Š” QUER

ๆœ€ๅณๆ™‚็š„Sybase ASE Server่ณ‡ๆ–™ๅบซ่จบๆ–ทๅทฅๅ…ท

Microsoft PowerPoint - Oracle Data Access Pattern.ppt

ยดร™รรŸ Row ยฐรกยฐรบยธยฆ ยดรœร€รร‡ร ร€ยธยทรŽ ร„ร„ยธยถยทรŽ ยบรยธยฎร‡ร˜ รƒรขยทร‚ร‡รยดร‚ ยนรฆยนรฝ

Microsoft Word - [Unioneinc] ํŠน์ •์ปฌ๋Ÿผ์˜ ํ†ต๊ณ„์ •๋ณด ๊ฐฑ์‹ _ _ldh.doc

๋ชฉ ์ฐจ

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a

DBMS & SQL Server Installation Database Laboratory

Tablespace On-Offline ํ…Œ์ด๋ธ”์ŠคํŽ˜์ด์Šค ์˜จ๋ผ์ธ/์˜คํ”„๋ผ์ธ

Microsoft Word - SQLํŠœ๋‹_์‹ค์Šต๊ต์žฌ_.doc

Oracle Database 10g: Self-Managing Database DB TSC

3 S Q L A n t i p a t t e r n s Trees/intro/parent.sql CREATE TABLE Comments ( comment_id SERIAL PRIMARY KEY, parent_id BIGINT UNSIGNED, comment TEXT

Microsoft Word - ๊ธฐ์ˆ ๋…ธํŠธ[19ํšŒ] Flashback.doc

DocsPin_Korean.pages

MS-SQL SERVER ๋Œ€๋น„ ๊ธฐ๋Šฅ

The Self-Managing Database : Automatic Health Monitoring and Alerting

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

Jerry Held

Orcad Capture 9.x

๋‹ค์–‘ํ•œ ์˜ˆ์ œ๋กœ ์‰ฝ๊ฒŒ ๋ฐฐ์šฐ๋Š” ์˜ค๋ผํด SQL ๊ณผ PL/SQL

ALTIBASE HDB Patch Notes

ๆญฏPLSQL10.PDF

untitled

Microsoft PowerPoint - Oracle Data Join Method.pptx [์ฝ๊ธฐ ์ „์šฉ]

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

ETL_project_best_practice1.ppt

NoSQL

๋‹ค์–‘ํ•œ ์˜ˆ์ œ๋กœ ์‰ฝ๊ฒŒ ๋ฐฐ์šฐ๋Š” ์˜ค๋ผํด SQL ๊ณผ PL/SQL

DW ๊ฐœ์š”.PDF

PowerChute Personal Edition v3.1.0 ์—์ด์ „ํŠธ ์‚ฌ์šฉ ์„ค๋ช…์„œ

FlashBackt.ppt

PRO1_09E [์ฝ๊ธฐ ์ „์šฉ]

TECHNICAL WHITE PAPER Tibero Optimizer SQL Execution Plan October 2012

์ œ๋ชฉ์„ ์ž…๋ ฅํ•˜์„ธ์š”.

๊ทธ๋ฆฌ๊ณ .. ์—‘์…€์—ํ•˜๋‚˜๋‘˜์™„๋ฃŒ๋œ์ฟผ๋ฆฌ๊ฐ€๋Š˜์–ด๋‚ ๋•Œ๋งˆ๋‹ค... ํฌ์—ด์„๋Š๋‚€๋‹ค... ์ด๊ธ€์„๋ณด๋Š”๋‹น์‹ ์€์–ด๋–ป๊ฒŒํ• ๊ฒƒ์ธ๊ฐ€? A ๊ตฐ์˜ํŒ๋‹จ์ด์ž˜๋ชป๋œ๊ฒƒ์ธ๊ฐ€? ์ž˜๋ชป๋œํŒ๋‹จ์ด์•„๋‹ˆ๋‹ค์ตœ์„ ์˜ํŒ๋‹จ์ด๋‹ค... 11g ์ „๊นŒ์ง€๋Š”... 11g New Feature ์ธ Pending Statistics ๋ฅผ SPA ์™€ํ•จ๊ป˜์‚ฌ์šฉ

PowerPoint Presentation

์Šฌ๋ผ์ด๋“œ 1

UNIST_๊ต์› ํ™ˆํŽ˜์ด์ง€ ๊ด€๋ฆฌ์ž_Manual_V1.0

DB ์„ฑ๋Šฅ๊ณ ๋„ํ™”ํ•ต์‹ฌ์›๋ฆฌ ๋น„ํˆฌ์—”์ปจ์„คํŒ… ์ˆ˜์„์ปจ์„คํ„ดํŠธ ์กฐ์‹œํ˜•

๋ฐฐ์น˜ํ”„๋กœ๊ทธ๋žจ์—์„œํŠœ๋‹๋Œ€์ƒ SQL ์ถ”์ถœํ•˜๊ธฐ ์—‘์…ˆ์ปจ์„คํŒ…๋ณธ๋ถ€ /DB ์ปจ์„คํŒ…ํŒ€๋ฐ•์„ฑํ˜ธ ๋ฐฐ์น˜ํ”„๋กœ๊ทธ๋žจ์˜์„ฑ๋Šฅ๋ฌธ์ œ๋ฅผ์ง„๋‹จํ•˜๊ธฐ์œ„ํ•ดํŠธ๋ ˆ์ด์Šค๋ฅผ์‚ฌ์šฉํ• ์ˆ˜์—†๊ณ , ๊ฐœ๋ณ„ SQL ์—๋Œ€ํ•œ์„ฑ ๋Šฅ์ ๊ฒ€์€๋น„ํšจ์œจ์ ์ธ๊ฒฝ์šฐ์—์–ด๋–ป๊ฒŒ๋ฐฐ์น˜ํ”„๋กœ๊ทธ๋žจ์˜์„ฑ๋Šฅ๋ฌธ์ œ๋ฅผ์ œ๋Œ€๋กœํŒŒ์•…ํ•˜๊ณ ๊ฐœ์„ ์•ˆ์„๋„ ์ถœํ• ๊ฒƒ์ธ๊ฐ€? ๋ณต์žกํ•œ๋กœ์ง์„๊ฐ€์ง€๊ณ ์žˆ๋Š”ํ”„๋กœ๊ทธ๋žจ (

untitled

OSR Analyzer Report

ร†รญยถรท4-ยผร–ยทรงยผร‡c03ร–รยพลก

์ดˆ๋ณด์ž๋ฅผ ์œ„ํ•œ ADO 21์ผ ์™„์„ฑ

Slide 1

๊ฒฐ๊ณผ๋ณด๊ณ ์„œ

ORACLE EXADATA HCC ์••์ถ•๋ฐฉ์‹์ดํ•ดํ•˜๊ธฐ ์—‘์…ˆ์ปจ์„คํŒ…๋ณธ๋ถ€ /DB ์ปจ์„คํŒ…ํŒ€๊น€์ฒ ํ™˜ ๊ฐœ์š” ์‹œ๊ฐ„์ด์ง€๋‚˜๋ฉด์„œ๋ฐ์ดํ„ฐ๋Š”๊ธ‰์†ํ•˜๊ฒŒ์ฆ๊ฐ€ํ•˜๊ณ ์žˆ๋‹ค. ๋ฐ์ดํ„ฐ๊ฐ€์ฆ๊ฐ€ํ•จ์—๋”ฐ๋ผ DBMS ์—์„œ๊ด€๋ฆฌ๋˜์–ด์ง€๋Š”์ •๋ณด๋„๊ธ‰์†ํ•˜๊ฒŒ์ฆ๊ฐ€ํ•˜๊ณ ์žˆ๋‹ค. ์ด๋กœ์ธํ•ด์ €์žฅ๊ณต๊ฐ„์˜๋ถ€์กฑ์œผ๋กœํ•˜๋“œ์›จ์–ด๋น„์šฉ์˜์ฆ๊ฐ€์™€๋ฐ์ดํ„ฐ์ฒ˜๋ฆฌ์„ฑ๋Šฅ์—๋งŽ์€๋ฌธ์ œ์ ๋“ค

์Šฌ๋ผ์ด๋“œ 1

Microsoft Word - Goodus_๊ธฐ์ˆ ๋…ธํŠธ[19ํšŒ]_Flashback

thesis

Remote UI Guide

PowerPoint Presentation

์œˆ๋ฐฑ๋ฐ์—…๊ทธ๋ ˆ์ด๋“œ Tibero Flashback ๊ฐ€์ด๋“œ

Data Sync Manager(DSM) Example Guide Data Sync Manager (DSM) Example Guide DSM Copyright 2003 Ari System, Inc. All Rights reserved. Data Sync Manager

๋‹ค์–‘ํ•œ ์˜ˆ์ œ๋กœ ์‰ฝ๊ฒŒ ๋ฐฐ์šฐ๋Š” ์˜ค๋ผํด SQL ๊ณผ PL/SQL

<4D F736F F D203033C6C4C6BCBCC72DB8AEBFC0B1D7B9E6B9FD2E646F63>

๋‹ค์–‘ํ•œ ์˜ˆ์ œ๋กœ ์‰ฝ๊ฒŒ ๋ฐฐ์šฐ๋Š” ์˜ค๋ผํด SQL ๊ณผ PL/SQL

PowerPoint Presentation

์˜ˆ์ œ์†Œ์Šค๋Š” ์—์„œ๋‹ค์šด๋กœ๋“œํ•˜์—ฌ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ํˆด๋ฐ”์˜ [ ์ƒˆ์ฟผ๋ฆฌ ]( ์—์•„๋ž˜์˜์†Œ์Šค๋ฅผ์ž…๋ ฅํ•œ๋‹ค. ์ž…๋ ฅํ›„์—๋Š”์•ž์œผ๋กœ์‹ค์Šต์„์œ„ํ•ด์„œ์ €์žฅํ•ด๋‘”๋‹ค. -- ์‹ค์Šต์—ํ•„์š”ํ•œ Madang DB ์™€ COMPANY DB ๋ฅผ๋ชจ๋‘์ƒ์„ฑํ•œ๋‹ค. -- ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์ƒ์„ฑ US

๊ต์œก2 ? ๊ทธ๋ฆผ

PowerPoint Presentation

Oracle hacking ์ž‘์„ฑ์ž : ์ž„๋™ํ˜„ ์ž‘์„ฑ์ผ 2008 ๋…„ 10 ์›” 11 ์ผ ~ 2008 ๋…„ 10 ์›” 19 ์ผ ์‹ ๊ทœ์ž‘์„ฑ ์ž‘์„ฑ๋‚ด์šฉ

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

Interstage5 SOAP์„œ๋น„์Šค ์„ค์ • ๊ฐ€์ด๋“œ

ยณยปรรถ_1รˆยฃ_0107L

MySQL-Ch10


1217 WebTrafMon II

R50_51_kor_ch1

SRC PLUS ์ œ์–ด๊ธฐ MANUAL

#KM-250(PB)

๊ฐ๊ด€์‹ 1. ์•„๋ž˜์˜์ฟผ๋ฆฌ๋ฅผ๋งŒ์กฑํ•˜๋Š”๊ฒฐ๊ณผ๋ฅผ๊ฐ€์žฅ์ž˜์„ค๋ช…ํ•œ๊ฒƒ์€? SELECT A.* FROM HR.EMPLOYEES A, HR.EMPLOYEES B WHERE 1=1 AND A.MANAGER_ID = B.EMPLOYEE_ID AND B.SALARY >= ANY A.SALARY;

์„ธ๋ฏธ๋‚˜(์žฅ์• ์™€๋ณต๊ตฌ-์ˆ˜๊ฐ•์ƒ์šฉ).ppt

๋ชฉ์ฐจ BUG DEQUEUE ์˜ WAIT TIME ์ด 1 ์ดˆ๋ฏธ๋งŒ์ธ๊ฒฝ์šฐ, ์„ค์ •ํ•œ์‹œ๊ฐ„๋งŒํผ๋Œ€๊ธฐํ•˜์ง€์•Š๋Š”๋ฌธ์ œ๊ฐ€์žˆ์Šต๋‹ˆ๋‹ค... 3 BUG [qp-select-pvo] group by ํ‘œํ˜„์‹์—์žˆ๋Š”์ปฌ๋Ÿผ์„์ฐธ์กฐํ•˜๋Š”์ง‘ํ•ฉ์—ฐ์‚ฐ์ด์กด์žฌํ•˜์ง€์•Š์œผ๋ฉด๊ฒฐ๊ด๊ฐ’์˜ค๋ฅ˜๊ฐ€๋ฐœ์ƒํ• ์ˆ˜์žˆ์Šต๋‹ˆ๋‹ค... 4

์˜ค๋ผํด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค 10g ํ•ต์‹ฌ ์š”์•ฝ ๋…ธํŠธ

MySQL-.. 1

USER GUIDE

InsertColumnNonNullableError(#colName) ์—ํ•ด๋‹นํ•˜๋Š”๋ฉ”์‹œ์ง€์ถœ๋ ฅ ์กด์žฌํ•˜์ง€์•Š๋Š”์ปฌ๋Ÿผ์—๊ฐ’์„์‚ฝ์ž…ํ•˜๋ ค๊ณ ํ• ๊ฒฝ์šฐ, InsertColumnExistenceError(#colName) ์—ํ•ด๋‹นํ•˜๋Š”๋ฉ”์‹œ์ง€์ถœ๋ ฅ ์‹คํ–‰๊ฒฐ๊ณผ๊ฐ€ primary key ์ œ์•ฝ์—์œ„๋ฐฐ๋œ๋‹ค๋ฉด, Ins

RUCK2015_Gruter_public

Microsoft Word - 03_SQL_CURSOR.doc

Simplify your Job Automatic Storage Management DB TSC

Tina Admin

Modern Javascript

Microsoft PowerPoint - 1_3_DBA_SQL_tuning

ORACLE-SQL

Transcription:

Goodus ๊ธฐ์ˆ ๋…ธํŠธ [38 ํšŒ ] Author ์œค๋ณ‘๊ธธ, ์ด์€์ • Creation Date 2009-02-27 Last Updated Version 1.0 Copyright(C) 2004 Goodus Inc. All Rights Reserved Version ๋ณ€๊ฒฝ์ผ์ž๋ณ€๊ฒฝ์ž ( ์ž‘์„ฑ์ž ) ์ฃผ์š”๋‚ด์šฉ 1 2009-02-27 ์œค๋ณ‘๊ธธ, ์ด์€์ •๋ฌธ์„œ์ตœ์ดˆ์ž‘์„ฑ

Contents 1. SQL Tunning ์€ํ•ด์•ผํ•œ๋‹ค, ๊ทธ๋Ÿฌ๋‚˜ SQL ์€์ˆ˜์ •ํ• ์ˆ˜์—†๋‹ค!...3 2. Stored Outline...4 2.1. Outline ์‚ฌ์šฉํ•  User ์—๊ฒŒ Outline ์‹คํ–‰ํ• ์ˆ˜์žˆ๋Š”๊ถŒํ•œ๋ถ€์—ฌ...4 2.2. Outline Test ํ™˜๊ฒฝ์กฐ์„ฑ...4 2.3. Outline ์ƒ์„ฑํ•  Table ์˜ํ†ต๊ณ„์ •๋ณด์ƒ์„ฑ...5 2.4. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL ์˜ Plan ํ™•์ธ...5 2.5. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL ๋กœ Outline ์ƒ์„ฑ...5 2.6. Tunning ๋œ SQL Plan ํ™•์ธ...5 2.7. Tunning ๋œ SQL ๋กœ Outline ์ƒ์„ฑ...6 2.8. ์ƒ์„ฑ๋œ Outline ๋“คํ™•์ธ...6 2.9. Outline ์ˆ˜์ •...6 2.10. Tunning ๋œ Plan ์‹คํ–‰์—ฌ๋ถ€ํ™•์ธ...8 2.11. Outline Tunning ์‹œ์œ ์˜์‚ฌํ•ญ...9 3. SQL Profile ( 10g )...9 3.1. SQL Profile ์‚ฌ์šฉํ•  User ์—๊ฒŒํ•„์š”๊ถŒํ•œ๋ถ€์—ฌ...9 3.2. SQL Profile Test ํ™˜๊ฒฝ์กฐ์„ฑ...9 3.3. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL Plan ํ™•์ธ...10 3.4. Tunning ๋œ SQL ์˜ Full Hint Naming ํ™•์ธ...10 3.5. SQL Profile ์ˆ˜๋™์ƒ์„ฑ...12 3.6. Tunning ๋œ Plan ์‹คํ–‰์—ฌ๋ถ€ํ™•์ธ...12 4. SQL Plan Baseline ( 11g )...13 4.1. SQL Plan Baseline Test ํ™˜๊ฒฝ์กฐ์„ฑ...13 4.2. Tunning ๋Œ€์ƒ SQL ์˜ Plan Baseline Capture...14 4.3. Tunning ๋Œ€์ƒ SQL ์˜ Plan Baseline ํ™•์ธ...15 4.4. Tunning ๋œ SQL Plan ์œผ๋กœ๋ณ€๊ฒฝ...16 4.5. ์ƒ์„ฑ๋œ Baseline ํ™•์ธ...17 4.6. ๋“ฑ๋กํ•œ Plan History ํ™•์ธ...17 4.7. Tunning ๋œ Plan ํ™œ์šฉํ™•์ธ...19-2

1. SQL Tunning ์€ํ•ด์•ผํ•œ๋‹ค, ๊ทธ๋Ÿฌ๋‚˜ SQL ์€์ˆ˜์ •ํ• ์ˆ˜์—†๋‹ค! SQL Tunning ์„ํ•„์š”๋กœํ•˜์ง€๋งŒ SQL Text ๋ฅผ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š”ํ™˜๊ฒฝ๋“ค์ด๋งŽ์ด์ƒ๊ธฐ๊ณ ์žˆ๋‹ค. Package ๋กœ๋‚ฉํ’ˆ๋œ์†”๋ฃจ์…˜๋“ค์ด๋‚˜, Java ์˜ Hibernate Framework ๊ฐ™์€๊ฒƒ๋“ค์ด๊ทธ์˜ˆ์ด๋‹ค. ์œ„์™€๊ฐ™์€ํ™˜๊ฒฝ์˜ SQL Tunning ์˜๋ขฐ๋ฅผ๋ฐ›์•˜์„๋•Œ์šฐ๋ฆฌ๊ฐ€ํ• ์ˆ˜์žˆ๋Š”๋ฐฉ๋ฒ•๋“ค์„์•Œ์•„๋ณด์ž. 1) Parameter ์ˆ˜์ • Parameter ๋ณ€๊ฒฝ์€์ „์—ญ์ ์ด์–ด์„œ์œ„ํ—˜์„ฑ์ด๋†’๋‹ค. ๊ทธ๋ฆฌ๊ณ ์‹ค์ œ๋กœ์‚ฌ์šฉํ• ์ˆ˜์žˆ๋Š”ํŒŒ๋ผ ๋ฏธํ„ฐ์˜์ˆ˜๋Š”๋งค์šฐ์ œํ•œ์ ์ด๋‹ค. 2) Physical Design ์ˆ˜์ • Partition ๋‚˜๋ˆ„๊ธฐ, Block Size ๋ฐ”๊พธ๊ธฐ, ๊ธฐํƒ€ Phsyical Atribute ๋ฅผ์ˆ˜์ •ํ•˜๋Š”๋ฐฉ๋ฒ•์ด์žˆ๋‹ค. 3) ํ†ต๊ณ„์ •๋ณด์กฐ์ž‘ Wolfgang Breitling ์—์˜ํ•ด์ฒด๊ณ„ํ™”๋œ TCF(Tuning By Cardinality Feedback) ๊ธฐ๋ฒ•์ด์—ฌ ๊ธฐ์—์†ํ•œ๋‹ค. CBO ๊ฐ€์˜ฌ๋ฐ”๋ฅธํŒ๋‹จ์„ํ• ์ˆ˜์žˆ๋„๋กํ†ต๊ณ„์ •๋ณด๋ฅผ๋ณด์™„ํ•ด์ฃผ๋Š”๊ธฐ๋ฒ•์ด๋‹ค. ์กฐ์ž‘๊ฐ€๋Šฅํ•œํ†ต๊ณ„์ •๋ณด์—๋Š”์ œํ•œ์ด์—†์œผ๋ฉฐ Table/Column/Index/Histogram ๋“ฑ๋ชจ๋“ ํ†ต๊ณ„์ •๋ณด๋ฅผ์ˆ˜๋™์œผ๋กœ์กฐ์ž‘ํ• ์ˆ˜์žˆ๋‹ค. ํ•˜์ง€๋งŒ, ์ˆ˜๋™์œผ๋กœ๋ณ€๊ฒฝ๋œํ†ต๊ณ„์ •๋ณด๋Š”์ž๋™๋ฐฑ์—… (10g) ์ด๋˜์ง€์•Š๋Š”๋‹ค๋Š”์‚ฌ์‹ค๊ณผํ†ต๊ณ„์ •๋ณด์ˆ˜์ง‘์‹œ๊ธฐ์กด์˜์กฐ์ž‘๋œํ†ต๊ณ„์ •๋ณด๋ฅผ๋ฎ์–ด์จ๋ฒ„๋ฆฐ๋‹ค๋Š”๊ฒƒ์„์œ ์˜ํ•˜์—ฌ์‚ฌ์šฉํ•˜์—ฌ์•ผํ•œ๋‹ค. Index ๋ฅผ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ Index Key ๋ฅผ๋ณ€๊ฒฝํ•˜๋Š”๊ฒƒ๋„๋„“์€๋ฒ”์œ„์—์„œ๋Š”์ด๋ฒ”์ฃผ์—์†ํ•œ๋‹ค. 4) Stored Outline Stored Outline ์€์›๋ž˜ Plan Stability ๋ฅผ๋ณด์žฅํ•˜๊ธฐ์œ„ํ•ด์ œ์•ˆ๋œ๊ฐœ๋…์ด์ง€๋งŒ, ์‹ค์„ธ๊ณ„์—์„œ์ด๋ชฉ์ ์œผ๋กœ์‚ฌ์šฉ๋˜๋Š”๊ฒฝ์šฐ๋Š”๊ฑฐ์˜์—†๋‹ค. ์˜คํžˆ๋ ค Outline ๋ฐ”๊ฟ”์น˜๊ธฐ๋ฅผํ†ตํ•ด Query Tuning ์˜๋„๊ตฌ๋กœํ™œ์šฉ๋˜๊ธฐ๋„ํ•œ๋‹ค. 5) SQL Profile 10g ์—์„œ์†Œ๊ฐœ๋œ SQL Profile ๋Š” SQL Tuning Advisor ๊ฐ€์ œ๊ณตํ•˜๋Š”๊ธฐ๋Šฅ์ค‘ํ•˜๋‚˜์ด๋‹ค. SQL Tuning Advisor ๋Š” SQL ๋ถ„์„ํ›„ Hint ์กฐ์ž‘์„ํ†ตํ•ด Query ์„ฑ๋Šฅ๊ฐœ์„ ์ด๊ฐ€๋Šฅํ•œ๊ฒฝ์šฐ์—๋Š”ํ•ด๋‹นํ•˜๋Š” Profile ์„์ œ๊ณตํ•œ๋‹ค. ์ด Profile ๋ฅผ์‚ฌ์šฉํ•˜๋ฉด Query ์˜์‹คํ–‰๊ณ„ํš์„์กฐ์ž‘ํ• ์ˆ˜์žˆ๋‹ค. - 3

DBMS_SQLTUNE ํŒจํ‚ค์ง€์˜ UNDOCUMENTED PROCEDURE ๋“ค์„์ด์šฉํ•˜๋ฉด์ˆ˜๋™์œผ๋กœ Profile ์„์ƒ์„ฑํ•˜๊ณ ์กฐ์ž‘ํ• ์ˆ˜๋„์žˆ๋‹ค. ์ด๊ด€์ ์—์„œ๋ณด๋ฉด Stored Outline ์„์‚ฌ์šฉํ•˜๋Š”๊ฒƒ๊ณผ๊ฑฐ์˜๋™์ผํ•œ๊ธฐ๋ฒ•์ด๋ผ๊ณ ํ• ์ˆ˜์žˆ๋‹ค. 6) Advanced Rewrite 10g ์—์„œ์†Œ๊ฐœ๋œ Advanced Rewrite ๋Š”ํŠน์ • SQL Text ๋ฅผ๊ฐ€๋กœ์ฑ„์„œ๋‹ค๋ฅธ SQL Text ๋กœ ๋ณ€ํ™˜ํ•˜๋Š”๊ธฐ๋Šฅ์„์˜๋ฏธํ•œ๋‹ค. DBMS_ADVANCED_REWRITE ํŒจํ‚ค์ง€๋ฅผ์ด์šฉํ•œ๋‹ค. ์–ธ๋œป๋ณด๋ฉด๊ฐ€์žฅ๊ฐ•๋ ฅํ•˜๊ณ ํ™•์‹คํ•œ๊ธฐ๋ฒ•์œผ๋กœ๋ณด์ธ๋‹ค. ํ•˜์ง€๋งŒ, Bind ๋ณ€์ˆ˜๊ฐ€์žˆ๋Š” Query ๋“ฑ์ด๊ธฐ๋ณธ์ ์œผ๋กœ์ง€์›๋˜์ง€์•Š๋Š”๋‹ค๋Š”์ ์€์น˜๋ช…์ ์ด๋‹ค. ๋˜ํ•œ Parse ๊ณผ์ •์—์„œ์˜๋ถ€ํ•˜๋ฅผ์ƒ๊ฐํ•ด๋ณด๋ฉด OLTP ์—๋Š”๋งž์ง€์•Š๋‹ค๋Š”๊ฒฐ๋ก ์„์–ป์„์ˆ˜์žˆ๋‹ค. DW ์„ฑ์˜์ฟผ๋ฆฌ์—์„œ์‚ฌ์šฉ๋ ๋ชฉ์ ์œผ๋กœ๊ณ ์•ˆ๋œ๊ฒƒ์ด๋‹ค. ํ•˜์ง€๋งŒ Parse ๊ณผ์ •์—์„œ์˜์˜ค๋ฒ„ํ—ค๋“œ๋ฅผ๊ฐ์ˆ˜ํ•ด์„œ๋ผ๋„ Query ์„ฑ๋Šฅ์„๋†’์—ฌ์•ผํ• ๋ช…๋ถ„์ด์žˆ๋‹ค๋ฉด๊ณ ๋ คํ•ด๋ณผ๋งŒํ•œ๋ฐฉ๋ฒ•์ด๋‹ค ์ด๋ฒˆ๊ธฐ์ˆ ๋…ธํŠธ์—์„œ๋Š” Stored Outline, 10g SQL Profile, 11g ์˜ SQL Baseline ์„์†Œ๊ฐœ ํ•˜๊ฒ ๋‹ค. 2. Stored Outline Stored Outline ์œผ๋กœ Plan ์„๊ณ ์ •์‹œํ‚ฌ์ˆ˜์žˆ๋‹ค. ๊ธฐ์กด์˜๋ฌธ์ œ๋˜๋Š”์ฟผ๋ฆฌ๋ฅผ๊ฐ€์ง€๊ณ , Outline ์„์ƒ์„ฑํ•˜์—ฌํ•ด๋‹น SQL Text ์—๋Œ€ํ•œ Plan ์„ Tunning ๋œ SQL ์—๋Œ€ํ•œ Plan ์œผ๋กœํ•ด๊ฒฐ๋˜๋„๋ก์œ ๋„ํ•˜์—ฌ์ˆ˜์ •๋ถˆ๊ฐ€ํ•œ SQL ์—๋Œ€ํ•œ Tunning ์„์‹œ๋„ํ• ์ˆ˜์žˆ๋‹ค. 2.1. Outline ์‚ฌ์šฉํ•  User ์—๊ฒŒ Outline ์‹คํ–‰ํ• ์ˆ˜์žˆ๋Š”๊ถŒํ•œ๋ถ€์—ฌ SQL> conn /as sysdba SQL> grant create any outline to nero; SQL> grant execute on dbms_outln to nero; SQL> grant execute on dbms_outln_edit to nero; 2.2. Outline Test ํ™˜๊ฒฝ์กฐ์„ฑ SQL> create table nero_detail as select scott.dept; SQL> create table nero_master as select scott.emp; Index ์ƒ์„ฑ - 4

SQL> alter table nero_detail add constraint nero_detail_pk primary key(empno); SQL> alter table nero_master add constraint nero_master_pk primary key(deptno); 2.3. Outline ์ƒ์„ฑํ•  Table ์˜ํ†ต๊ณ„์ •๋ณด์ƒ์„ฑ SQL> exec dbms_stats.gather_table_stats(user,'nero_detail', cascade=>true, no_invalidate=>false); SQL> exec dbms_stats.gather_table_stats(user,'nero_master', cascade=>true, no_invalidate=>false); 2.4. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL ์˜ Plan ํ™•์ธ SQL> set autotrace traceonly explain SQL> select e.ename from nero_detail e, nero_master d where e.deptno = d.deptno; --------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time --------------------------------------------------------------------------------- 0 SELECT STATEMENT 14 168 3 (0) 00:00:01 1 NESTED LOOPS 14 168 3 (0) 00:00:01 * 2 TABLE ACCESS FULL nero_detail 14 126 3 (0) 00:00:01 * 3 INDEX UNIQUE SCAN nero_master_pk 1 3 0 (0) 00:00:01 --------------------------------------------------------------------------------- Nested Loop Join ์œผ๋กœํ’€๋ฆฌ๋Š”๊ฒƒ์„ํ™•์ธํ•œ๋‹ค. 2.5. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL ๋กœ Outline ์ƒ์„ฑ SQL> set autotrace off SQL> create or replace outline ORG_OTLN on select e.ename from nero_detail e, nero_master d where e.deptno = d.deptno; 2.6. Tunning ๋œ SQL Plan ํ™•์ธ SQL> set autotrace traceonly explain SQL> select /*+ use_hash(d) */ e.ename from nero_detail e, nero_master d where e.deptno = d.deptno; --------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time --------------------------------------------------------------------------------- - 5

0 SELECT STATEMENT 14 168 5 (20) 00:00:01 * 1 HASH JOIN 14 168 5 (20) 00:00:01 2 INDEX FULL SCAN nero_master_pk 4 12 1 (0) 00:00:01 * 3 TABLE ACCESS FULL nero_detail 14 126 3 (0) 00:00:01 --------------------------------------------------------------------------------- 2.7. Tunning ๋œ SQL ๋กœ Outline ์ƒ์„ฑ SQL> create or replace outline NEW_OTLN on select /*+ use_hash(d) */ e.ename from nero_detail e, nero_master d where e.deptno = d.deptno; 2.8. ์ƒ์„ฑ๋œ Outline ๋“คํ™•์ธ SQL> select name, sql_text from user_outlines; NAME SQL_TEXT --------- -------------------------------------------------------------------------------- ORG_OTLN select e.ename from nero_detail e, nero_master d where e.deptno = d.deptno NEW_OTLN select /*+ use_hash(d) */ e.ename from nero_detail e, nero_master d where e.dept 2.9. Outline ์ˆ˜์ • - Stored Outline ์„์ˆ˜์ •ํ•˜๊ธฐ์œ„ํ•˜์—ฌ outln user ๋กœ๋ณ€๊ฒฝ SQL> conn outln/outln - ORG_OTLN, NEW_OTLN ์—๋Œ€ํ•œ์‹ค์ œ Outline ํ™•์ธํ•œ๋‹ค. SQL> select ol_name, hint#, hint_text from ol$hints; OL_NAME HINT# HINT_TEXT --------- ------ ----------------------------------------------------------- ORG_OTLN ORG_OTLN ORG_OTLN ORG_OTLN ORG_OTLN ORG_OTLN 1 USE_NL(@"SEL$1" "D"@"SEL$1") 2 LEADING(@"SEL$1" "E"@"SEL$1" "D"@"SEL$1") 3 INDEX(@"SEL$1" "D"@"SEL$1" ("nero_master"."deptno")) 4 FULL(@"SEL$1" "E"@"SEL$1") 5 OUTLINE_LEAF(@"SEL$1") 6 ALL_ROWS - 6

ORG_OTLN ORG_OTLN NEW_OTLN NEW_OTLN NEW_OTLN NEW_OTLN NEW_OTLN NEW_OTLN NEW_OTLN NEW_OTLN 7 OPTIMIZER_FEATURES_ENABLE('10.2.0.1') 8 IGNORE_OPTIM_EMBEDDED_HINTS 2 LEADING(@"SEL$1" "D"@"SEL$1" "E"@"SEL$1") 3 FULL(@"SEL$1" "E"@"SEL$1") 4 INDEX(@"SEL$1" "D"@"SEL$1" ("nero_master"."deptno")) 5 OUTLINE_LEAF(@"SEL$1") 6 ALL_ROWS 7 OPTIMIZER_FEATURES_ENABLE('10.2.0.1') 8 IGNORE_OPTIM_EMBEDDED_HINTS 1 USE_HASH(@"SEL$1" "E"@"SEL$1") SQL> select ol_name, sql_text, category, hintcount from outln.ol$; OL_NAME SQL_TEXT CATEGORY HINTCOUNT ---------- ------------------------------------------------- -------- ---------- NEW_OTLN select /*+ use_hash(d) */ e.ename from o DEFAULT 8 ORG_OTLN select e.ename from nero_detail e, nero_master d DEFAULT 8 - ํžŒํŠธ์นด์šดํŠธ๋ฅผ๋งž์ถ”๊ธฐ์œ„ํ•ด ORG_OTLN ์˜ Hintcount ๋ฅผ NEW_OTLN ์˜ Hintcount ๋กœ๋ณ€๊ฒฝ SQL> update outln.ol$ set hintcount = (select hintcount from outln.ol$ where ol_name='new_otln') where ol_name='org_otln'; 1 row updated - Nested Loop ์‹คํ–‰๊ณ„ํš์š”์•ฝ๋ณธ์€์ด์ œ๋”์ด์ƒํ•„์š”์—†์œผ๋ฏ€๋กœ ORG_OTLN ์˜ํžŒ ํŠธ๋“ค์€์‚ญ์ œ SQL> delete from ol$hints where ol_name = 'ORG_OTLN'; 8 rows deleted. - ORG_OTLN ์˜ํžŒํŠธ๋ฅผ์‚ญ์ œํ›„ NEW_OTLN ๋ฒˆ์˜ํžŒํŠธ๋“ค์ด ORG_OTLN ์˜ํžŒํŠธ๊ฐ€ ๋˜๋„๋ก OL_NAME ์„๋ฐ”๊ฟˆ. SQL> update ol$hints set ol_name = 'ORG_OTLN' where ol_name='new_otln'; - 7

8 rows updated. - ol$nodes ๋ทฐ์˜ ORG_OTLN ์˜๋‚ด์šฉ์‚ญ์ œํ›„์—…๋ฐ์ดํŠธ SQL> select * from ol$nodes where ol_name in('org_otln','new_otln'); OL_NAME CATEGORY NODE_ID PARENT_ID NODE_TYPE NODE_TEXTLEN NODE_TEXTOFF NODE_NAME --------- --------- -------- ---------- ---------- ------------ ------------ ---------- ORG_OTLN DEFAULT 1 0 3 65 1 SEL$1 NEW_OTLN DEFAULT 1 0 3 84 1 SEL$1 SQL> delete from ol$nodes where ol_name ='ORG_OTLN'; 1 row deleted. - ORG_OTLN ์˜ํžŒํŠธ๋ฅผ์‚ญ์ œํ›„ NEW_OTLN ๋ฒˆ์˜ํžŒํŠธ๋“ค์„ ORG_OTLN ์˜ํžŒํŠธ๊ฐ€๋˜๋„๋ก OL_NAME ์„๋ฐ”๊ฟ”๋ฒ„๋ฆผ SQL> update ol$nodes set ol_name = 'ORG_OTLN' where ol_name ='NEW_OTLN'; 1 row updated SQL> commit; 2.10. Tunning ๋œ Plan ์‹คํ–‰์—ฌ๋ถ€ํ™•์ธ. SQL> conn nero/nero SQL> alter session set use_stored_outlines=true; SQL> set autotrace traceonly explain SQL> select e.ename from nero_detail e, nero_master d where e.deptno = d.deptno; -- ๊ฐ™์€ SQL ๋ฌธ์žฅ์ด์ง€๋งŒ์‹คํ–‰๊ณ„ํš์€ Hash Join ์œผ๋กœ์ˆ˜ํ–‰๋จ์„ํ™•์ธ๊ฐ€๋Šฅํ•จ. --------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time --------------------------------------------------------------------------------- - 8

0 SELECT STATEMENT 14 168 5 (20) 00:00:01 * 1 HASH JOIN 14 168 5 (20) 00:00:01 2 INDEX FULL SCAN nero_master_pk 4 12 1 (0) 00:00:01 * 3 TABLE ACCESS FULL nero_detail 14 126 3 (0) 00:00:01 --------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("e"."deptno"="d"."deptno") 3 - filter("e"."deptno" IS NOT NULL) Note ----- - outline "ORG_OTLN" used for this statement 2.11. Outline Tunning ์‹œ์œ ์˜์‚ฌํ•ญ 1) ๋ฐ”๊ฟ€ PLAN ์ด USE_CONCAT ํžŒํŠธ๋ฅผ์‚ฌ์šฉํ•˜๋Š” OR-Expansion ์˜๊ฒฝ์šฐ์—๋Š” concatenation ๋˜๋Š” 2 ๋ฒˆ์งธ์ฟผ๋ฆฌ๋ธ”๋Ÿญ์€ OL$HINTS ์—์„œ HINT ์ œ์–ด๋ฅผํ• ์ˆ˜์—†๋‹ค. 2) 10.2.0.3 ์ดํ•˜๋ฒ„์ „์—์„œ๋Š” Outline ์ƒ์„ฑํ›„ LCO ๋ฅผ invalidation ์‹œ์ผœ์•ผํ•˜๋Š”๋ฐ, Cursor ๋ณ„ Purge ๊ธฐ๋Šฅ (patch5614566 - aix,linux ๋Š” 10203 ์—๋„ backporting ๋จ ) ์„์‚ฌ์šฉํ•˜์ง€๋ชปํ•œ๋‹ค. 3) cursor_sharing = force(similar) ๋ฅผ์‚ฌ์šฉํ•˜๋Š”๊ฒฝ์šฐ์‚ฌ์šฉํ• ์ˆ˜์—†๋‹ค. 4) Outline ์ด SQL Text ๋ฅผ๋น„๊ตํ•˜๋Š”๋ฐฉ์‹์ด๋ผ์„œ SQL Text ๊ฐ€์™„๋ฒฝํ•˜๊ฒŒ๋™์ผํ•ด์•ผํ•œ๋‹ค. 3. SQL Profile ( 10g ) Stored Outline ์€ Full, Index ์™€๊ฐ™์€ Direct Hint ๋กœ๊ตฌ์„ฑ๋˜์ง€๋งŒ, SQL Profile ์€ OPT_ESTIMATE ์™€๊ฐ™์ด Cardinality ๋ฅผ์ œ์–ดํ•˜๋Š” Hint ๋กœ๊ตฌ์„ฑ๋˜์–ด์žˆ๋‹ค. 3.1. SQL Profile ์‚ฌ์šฉํ•  User ์—๊ฒŒํ•„์š”๊ถŒํ•œ๋ถ€์—ฌ SQL> grant ALTER ANY SQL PROFILE to sqlprf; 3.2. SQL Profile Test ํ™˜๊ฒฝ์กฐ์„ฑ SQL> create table lms_mst as select * from scott.dept; SQL> create table lms_dtl as select * from scott.emp; - 9

Index ์ƒ์„ฑ SQL> alter table lms_dtl add constraint nero_detail_pk primary key(empno); SQL> alter table lms_mst add constraint nero_master_pk primary key(deptno); 3.3. ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL Plan ํ™•์ธ SQL> explain plan for select /*+ use_nl(e d) */ e.ename from lms_dtl e, lms_mst d where e.deptno = d.deptno; SQL> select * from table(dbms_xplan.display); ------------------------------------------------------------------------------ Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------ 0 SELECT STATEMENT 14 168 8 (0) 00:00:01 1 NESTED LOOPS 14 168 8 (0) 00:00:01 2 TABLE ACCESS FULL LMS_MST 4 12 3 (0) 00:00:01 * 3 TABLE ACCESS FULL LMS_DTL 4 36 1 (0) 00:00:01 ------------------------------------------------------------------------------ 3.4. Tunning ๋œ SQL ์˜ Full Hint Naming ํ™•์ธ Advanced Option ์„์ด์šฉํ•˜์—ฌ Full Hint Naming ์„ํ™•์ธํ•œ๋‹ค. SQL Profile ์„์ˆ˜๋™์กฐ์ž‘ ํ•˜๋ ค๋ฉด Full Hint Naming Convention ์„์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค. SQ> explain plan for select /*+ use_hash(d) */ e.ename from lms_dtl e, lms_mst d where e.deptno = d.deptno; SQL> select * from table(dbms_xplan.display(null, null, advanced)); ------------------------------------------------------------------------------ Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------ 0 SELECT STATEMENT 14 168 7 (15) 00:00:01 * 1 HASH JOIN 14 168 7 (15) 00:00:01 2 TABLE ACCESS FULL LMS_MST 4 12 3 (0) 00:00:01 3 TABLE ACCESS FULL LMS_DTL 14 126 3 (0) 00:00:01 ------------------------------------------------------------------------------ - 10

PLAN_TABLE_OUTPUT ------------------------------------------------------------- Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------- 1 - SEL$1 2 - SEL$1 / D@SEL$1 3 - SEL$1 / E@SEL$1 Outline Data ------------- /*+ PLAN_TABLE_OUTPUT ------------------------------------------------------------- BEGIN_OUTLINE_DATA USE_HASH(@"SEL$1" "E"@"SEL$1") LEADING(@"SEL$1" "D"@"SEL$1" "E"@"SEL$1") FULL(@"SEL$1" "E"@"SEL$1") FULL(@"SEL$1" "D"@"SEL$1") OUTLINE_LEAF(@"SEL$1") ALL_ROWS OPTIMIZER_FEATURES_ENABLE('10.2.0.4') IGNORE_OPTIM_EMBEDDED_HINTS END_OUTLINE_DATA */ PLAN_TABLE_OUTPUT ------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("e"."deptno"="d"."deptno") Column Projection Information (identified by operation id): - 11

----------------------------------------------------------- 1 - (#keys=1) "E"."ENAME"[VARCHAR2,10] 2 - "D"."DEPTNO"[NUMBER,22] PLAN_TABLE_OUTPUT ------------------------------------------------------------- 3 - "E"."ENAME"[VARCHAR2,10], "E"."DEPTNO"[NUMBER,22] 3.5. SQL Profile ์ˆ˜๋™์ƒ์„ฑ SQL Profile ์„๊ตฌ์„ฑํ•  Hint ์˜๋ชฉ๋ก์„์ œ๊ณตํ•ด์•ผํ•˜๋ฉฐ, ๋ฐ˜๋“œ์‹œ Full Hint Naming Convention ์„์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค. Tunning ๋œ Full Hint Name ์„, ์ˆ˜์ •ํ• ์ˆ˜์—†๋Š” SQL ๊ณผํ•จ๊ป˜ import ํ•œ๋‹ค. SQL> begin dbms_sqltune.import_sql_profile( name=>'nero_prof', sql_text=> 'select /*+ use_nl(e d) */ e.ename from lms_dtl e, lms_mst d where e.deptno = d.deptno', profile=>sqlprof_attr('use_hash(@"sel$1" "E"@"SEL$1")', 'LEADING(@"SEL$1" "D"@"SEL$1" "E"@"SEL$1")', 'FULL(@"SEL$1" "E"@"SEL$1")', 'FULL(@"SEL$1" "D"@"SEL$1")') ); end; / PL/SQL procedure successfully completed. 3.6. Tunning ๋œ Plan ์‹คํ–‰์—ฌ๋ถ€ํ™•์ธ. SQL> explain plan for select /*+ use_nl(e d) */ e.ename from lms_dtl e, lms_mst d where e.deptno = d.deptno; SQL> select * from table(dbms_xplan.display); ----------------------------------------------------------------------------- - 12

Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------ 0 SELECT STATEMENT 14 168 7 (15) 00:00:01 * 1 HASH JOIN 14 168 7 (15) 00:00:01 2 TABLE ACCESS FULL LMS_MST 4 12 3 (0) 00:00:01 3 TABLE ACCESS FULL LMS_DTL 14 126 3 (0) 00:00:01 ------------------------------------------------------------------------------ PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("e"."deptno"="d"."deptno") Note ----- - SQL profile "nero_prof" used for this statement 4. SQL Plan Baseline ( 11g ) - SQL Magement Base SQL Plan Management ๋ฅผ๊ด€๋ฆฌํ•˜๋Š” Library - Statement Log ๋ฐ˜๋ณต๋˜๋Š” SQL ๋ฌธ์žฅ์„ plan history ์—๊ธฐ๋ก, ํ•„์š”์‹œ๋งˆ๋‹คํ™œ์šฉ - Automatic SQL Tuning Task Load ๋Ÿ‰์ด๋งŽ์€ SQL ๋ฌธ์„๋™๋“ฑํ•˜๊ฑฐ๋‚˜๋”๋‚˜์€๊ณ„ํš๋งŒ์„์‚ฌ์šฉ - SMB (Segment Management Base) SQL Profile, Plan History, Plan Baselines, Plan History, Statement Log 4.1. SQL Plan Baseline Test ํ™˜๊ฒฝ์กฐ์„ฑ SQL> create table bls_mst as select * from scott.dept; SQL> create table bls_dtl as select * from scott.emp; - 13

Index ์ƒ์„ฑ SQL> alter table bls_dtl add constraint nero_detail_pk primary key(empno); SQL> alter table bls_mst add constraint nero_master_pk primary key(deptno); ํ†ต๊ณ„์ •๋ณด์ƒ์„ฑ SQL> exec dbms_stats.gather_table_stats(user, 'bls_mst', no_invalidate=>false); SQL> exec dbms_stats.gather_table_stats(user, 'bls_dtl', no_invalidate=>false); 4.2. Tunning ๋Œ€์ƒ SQL ์˜ Plan Baseline Capture SQL> alter session set optimizer_capture_sql_plan_baselines = true; SQL> select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.deptno; ENAME ---------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER 14 rows selected. SQL> select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.deptno; ENAME - 14

---------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER 14 rows selected. SQL> alter session set optimizer_capture_sql_plan_baselines = false; 4.3. Tunning ๋Œ€์ƒ SQL ์˜ Plan Baseline ํ™•์ธ SQL> col sql_handle new_value v_sql_handle SQL> select sql_handle from dba_sql_plan_baselines 2 where sql_text like 'select /*+ use_nl(e d) */ e.ename%'; SQL_HANDLE ------------------------------ SYS_SQL_ae6d7e4ca2ffd67c SQL> select * from dba_sql_plan_baselines where sql_handle ='SYS_SQL_ae6d7e4ca2ffd67c'; 1.2569E+19 SYS_SQL_ae6d7e4ca2ffd67c select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.d SYS_SQL_PLAN_a2ffd67c3c380fcf SQLBSLN AUTO-CAPTURE SQLBSLN 11.1.0.6.0 09/03/03 20:47:11.000000 09/03/03-15

20:47:11.000000 09/03/03 20:47:36.000000 YES YES NO YES 3 SQL*Plus Column Value ๋งŒํฌํ•จํ•˜์˜€์Œ. 4.4. Tunning ๋œ SQL Plan ์œผ๋กœ๋ณ€๊ฒฝ SQL> select /*+ use_hash(d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.deptno; ENAME ---------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER 14 rows selected. SQL> select sql_id, plan_hash_value from v$sql where sql_text like 'select /*+ use_hash(d) */ e.ename%'; SQL_ID PLAN_HASH_VALUE ------------- --------------- 0qwm4r9r8dyyn 1553352241 SQL> var nero_var number; - 16

SQL> exec :nero_var := dbms_spm.load_plans_from_cursor_cache(- sql_id=>'0qwm4r9r8dyyn', - plan_hash_value=>1553352241, - sql_handle=>'sys_sql_ae6d7e4ca2ffd67c'); PL/SQL procedure successfully completed. 4.5. ์ƒ์„ฑ๋œ Baseline ํ™•์ธ. Tunning ๋˜์ง€๋ชปํ•œ SQL Text ๋กœ๋‘๊ฐœ์˜ Baseline ์ด์ƒ์„ฑ๋œ๊ฒƒ์„ํ™•์ธํ•œ๋‹ค. SQL> select sql_handle, sql_text from dba_sql_plan_baselines where sql_text like 'select /*+ use_nl(e d) */ e.ename%'; SQL_HANDLE ------------------------------ SQL_TEXT -------------------------------------------------------------------------------- SYS_SQL_ae6d7e4ca2ffd67c select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.d SYS_SQL_ae6d7e4ca2ffd67c select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.d 4.6. ๋“ฑ๋กํ•œ Plan History ํ™•์ธ. SQL> select * from table(dbms_xplan.display_sql_plan_baseline(' SYS_SQL_ae6d7e4ca2ffd67c )); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- SQL handle: SYS_SQL_ae6d7e4ca2ffd67c SQL text: select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.deptno -------------------------------------------------------------------------------- - 17

-------------------------------------------------------------------------------- Plan name: SYS_SQL_PLAN_a2ffd67c3c380fcf Enabled: YES Fixed: NO Accepted: YES Origin: AUTO-CAPTURE -------------------------------------------------------------------------------- Plan hash value: 386123697 ------------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------------- 0 SELECT STATEMENT 14 168 3 (0) 00:00:01 1 NESTED LOOPS 14 168 3 (0) 00:00:01 2 TABLE ACCESS FULL BLS_DTL 14 126 3 (0) 00:00:01 * 3 INDEX UNIQUE SCAN NERO_MASTER_PK 1 3 0 (0) 00:00:01 ------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("e"."deptno"="d"."deptno") -------------------------------------------------------------------------------- Plan name: SYS_SQL_PLAN_a2ffd67c694097be Enabled: YES Fixed: NO Accepted: YES Origin: MANUAL-LOAD -------------------------------------------------------------------------------- Plan hash value: 1553352241 ------------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------------- 0 SELECT STATEMENT 14 168 5 (20) 00:00:01 * 1 HASH JOIN 14 168 5 (20) 00:00:01 2 INDEX FULL SCAN NERO_MASTER_PK 4 12 1 (0) 00:00:01 3 TABLE ACCESS FULL BLS_DTL 14 126 3 (0) 00:00:01 ------------------------------------------------------------------------------------- Predicate Information (identified by operation id): - 18

--------------------------------------------------- 1 - access("e"."deptno"="d"."deptno") 4.7. Tunning ๋œ Plan ํ™œ์šฉํ™•์ธ SQL> alter session set optimizer_use_sql_plan_baselines = true; SQL> explain plan for 2 select /*+ use_nl(e d) */ e.ename from bls_dtl e, bls_mst d where e.deptno = d.deptno; SQL> select * from table(dbms_xplan.display); Plan hash value: 386123697 ------------------------------------------------------------------------------------- Id Operation Name Rows Bytes Cost (%CPU) Time ------------------------------------------------------------------------------------- 0 SELECT STATEMENT 14 168 3 (0) 00:00:01 1 NESTED LOOPS 14 168 3 (0) 00:00:01 2 TABLE ACCESS FULL BLS_DTL 14 126 3 (0) 00:00:01 * 3 INDEX UNIQUE SCAN NERO_MASTER_PK 1 3 0 (0) 00:00:01 ------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("e"."deptno"="d"."deptno") Note ----- - SQL plan baseline "SYS_SQL_PLAN_a2ffd67c3c380fcf" used for this statement ์กฐ์ •๋œ Query ๊ฐ€ Cost ๊ฐ€๋†’์œผ๋ฏ€๋กœ, ์กฐ์ •์ „์˜ Query ์˜ Plan ์ด์‹คํ–‰๋œ๋‹ค. - 19