Professional Documents
Culture Documents
<easure performance as early as possi!le *onsider prototyping critical portions of the applications *onsider de=normali-ation and other performance !y design features early on
ffective SQ6 tuning re@uires either familiarity with these tools or the use of commercial alternatives such as SQ6a!
!$%L&'( %L&(
(he >56A#? 56A? reveals the e$ecution plan for an SQ6 statement. (he e$ecution plan reveals the e$act se@uence of steps that the ,racle optimi-er has chosen to employ to process the SQ6. (he e$ecution plan is stored in an ,racle ta!le called the 8plan ta!le9 Suita!ly formatted @ueries can !e used to e$tract the e$ecution plan from the plan ta!le.
T-prof output
!"#$2 ------ -----P)1*') 1+ E9' "$': 1' F'$ ; 27< ------ -----$!$)( 22 %"& '()%*'+, +-*./ 0"'123 "11'#$4 ------ -------- ------- -------- -------7872 7871 7 7 7 7877 7877 7 7 7 1,1817 1,183/ 12&4 1,/7711 &63&&2 ------ -------- ------- -------- -------1,1812 1,1833 12&4. 1,/7711> &63&&2? 1!5*6 -----7 7 ==-----==;
R!5*( E9' "$-!# P()#@ ------- --------------------------------------------------7 SELECT STATEMENT GOALA CBOOSE == FILTER =3361 TABLE ACCESS GOALA ANALYCED DFULLE OF FCUSTOMERSF =3/62 TABLE ACCESS GOALA ANALYCED DFULLE OF FEMPLOYEESF
#sing SQLa"
+ecause >56A#? 56A? and t)prof are unwieldy and hard to interpret, third party tools that automate the process and provide e$pert advice improve SQ6 tuning efficiency. (he Quest SQ6a! productA
; #dentifies SQ6 your data!ase that could !enefit from tuning ; 5rovides a sophisticated tuning environment to e$amine, compare and evaluate e$ecution plans. ; #ncorporates an e$pert system to advise on inde$ing and SQ6 statement changes
700
%erge 3 indexes
Index on Surname+f irstname Index on Surname+f irstname+#O$ Index on Surname+f irstname+do +!"oneo 0
20
0it1map inde)es
; *ontrary to widespread !elief, can !e effective when there are many distinct column values ; ?ot suita!le for ,6(5 however
100
10
0'1
0'01 1 10 $itma! index 100 1(000 #istinct )alues $-./ree index 0ull ta le scan 10(000 100(000 1(000(000
Index range scan +34L*, 0ull index scan 0ull ta le scan 2arallel ta le scan fast full index 2arallel fast full index 0 2'44 5 10 *la!sed time +s, 15 20 5'23 4'14 12'53 17'76
11'83
Oracle 8 semi19oins
,ptimi-es @ueries using >#S(S where there is no supporting inde$
No index on employees *'(' $ G >1!@ "*$!@'1* 5;'1' '9-*$* D*'(' $ 1 >1!@ '@%(!2''* ' 5;'1' '8*"1#)@'H 8 !#$) $_*"1#)@' )#+ '8>-1*$#)@'H 8 !#$) $_>-1*$#)@' )#+ '8+)$'_!>_:-1$;H 8+)$'_!>_:-1$;E
Oracle 8 semi19oins
Dithout the semi=1oin or supporting inde$, @ueries li)e the one on the preceding slide will perform very !adly. ,racle will perform a ta!lescan of the inner ta!le for each row retrieved !y the outer ta!le #f customers has 144,444 rows, and employees 044 rows then 04 <#66#,? rows will !e processedK #n ,racle/, you should create the inde$ or use an #?= !ased su!@uery #n ,racle0, the semi=1oin facility allows the @uery to !e resolved !y a sort=merge or hash 1oin.
To #se semi19oins
Set A6DAHSBS <#BP,#?LHASH or < &G in #?#(.,&A, OR 3se a < &G BSP or HASHBSP hint in the su!@uery of the SQ6 statement
SELECT * FROM customers c WHERE exists (select /*+merge_sj*/ 1 from employees e where .)
Oracle8 semi19oins
(he performance improvements are impressive Fnote the logarithmic scaleG
1(343'11 *7IS/S no semi.8oin or indexes
10
1(000
10(000
1'14
0'01
10
50
*la!sed time
40
30
20
10
0 0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 <rra& si=e
0onus hint: @hen /our SQL is tunedA loo- to /our Oracle configuration
Dhen SQ6 is inefficient there is limited !enefit in investing in ,racle server or operating system tuning. However, once SQ6 is tuned, the limiting factor for performance will !e ,racle and operating system configuration. #n particular, chec) for internal ,racle contention that typically shows up as latch contention or unusual wait conditions F!uffer !usy, free !uffer, etcG (hird party tools ; such as QuestQs Spotlight on ,racle product ; can !e invalua!le
www.quest.com