SlideShare uma empresa Scribd logo
1 de 44
Doug Burns dougburns@yahoo.com
http://oracledoug.com
@orcldoug
#OTW
#OakTable
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Who am I?
 Why am I talking?
 Setting Expectations
01/10/2013
 I am Doug
 Doug I am << Dr Seuss Edition
 Actually I am Douglas
 … or, if you're Scottish, Dougie or Doogie
 I'm not from England
 You will have probably noticed that already
 I don't know many Scottish people who do glowing introductions about
their all-round genius!
 But, amongst other things, I am …
01/10/2013
01/10/2013
01/10/2013
01/10/2013
 A long time ago in a galaxy far, far away ….
 "A look under the hood of CBO: The 10053 Event"
 Wolfgang Breitling (see References)
 Time passes & beers are consumed & conversations follow …
 You almost never need to use 10053 trace files
 They are far too long and complex to understand
 … and yet …
 I find myself using them more often
 I think they're becoming easier to understand
01/10/2013
01/10/2013
 10053 files, like most Oracle trace files are
 Useful in specific situations
 Very detailed and informative
 Relatively easy to generate
 They are also
 Usually unnecessary
 Undocumented
 Subject to change over time
 Complex in places
01/10/2013
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Contains a record of the Cost Based Optimizer decision
making process and the various inputs used
 Hard Parse Time
 As we'll see, it contains
 Server configuration items that influence the CBO
 Object and System Statistics used by calculations
 Execution Plan Steps that were considered and accepted
▪ Resulting in final overall execution plan
 Execution Plan Steps that were considered and rejected
▪ Including the reasons why
01/10/2013
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 By enabling event 10053 using any of the usual methods
 Run (or Explain) the SQL statement
 Disable event
 Find trace file in user_dump_dest
01/10/2013
show parameter user_dump_dest
ALTER SESSION SET tracefile_identifier='EXAMPLE1_10053';
ALTER SESSION SET events '10053 trace name context forever, level 1';
SELECT * FROM dual;
ALTER SESSION SET events '10053 trace name context off';
 The statement must be hard-parsed
 The statement must not have been run before
 Plan has been aged out of cursor cache
 Shared pool has been flushed
 New version of the statement by adding a unique comment
01/10/2013
show parameter user_dump_dest
ALTER SESSION SET tracefile_identifier='EXAMPLE1_10053_1';
ALTER SESSION SET events '10053 trace name context forever, level 1';
SELECT /* EXAMPLE1_1 */ * FROM dual;
ALTER SESSION SET events '10053 trace name context off';
 Oracle 11g introduces a new tracing infrastructure
 Can be accessed using
 ALTER SESSION
 ORADEBUG
 DBMS_SQLDIAG.DUMP_TRACE
▪ Does not require Diagnostics Pack license
01/10/2013
 Replacement for original method of setting event 10053
 Main 10053-related Options
 SQL_Compiler and SQL_Optimizer
01/10/2013
show parameter user_dump_dest
ALTER SESSION SET tracefile_identifier='EXAMPLE1_2_OPTTRACE';
ALTER SESSION SET events 'trace [SQL_Compiler.*]';
SELECT /* EXAMPLE1_2 */ * FROM dual;
ALTER SESSION SET events 'trace [SQL_Compiler.*] off';
 There are also sub-options
01/10/2013
SQL> oradebug doc component SQL_Compiler
SQL_Compiler SQL Compiler
SQL_Parser SQL Parser (qcs)
SQL_Semantic SQL Semantic Analysis (kkm)
SQL_Optimizer SQL Optimizer
SQL_Transform SQL Transformation (kkq, vop, nso)
SQL_MVRW SQL Materialized View Rewrite
SQL_VMerge SQL View Merging (kkqvm)
SQL_Virtual SQL Virtual Column (qksvc, kkfi)
SQL_APA SQL Access Path Analysis (apa)
SQL_Costing SQL Cost-based Analysis (kko, kke)
SQL_Parallel_Optimization SQL Parallel Optimization (kkopq)
SQL_Code_Generator SQL Code Generator (qka, qkn, qke,
kkfd, qkx)
SQL_Parallel_Compilation SQL Parallel Compilation (kkfd)
SQL_Expression_Analysis SQL Expression Analysis (qke)
SQL_Plan_Management SQL Plan Managment (kkopm)
MPGE MPGE (qksctx)
 What if you want to trace just one SQL statement that a
Session executes?
 Perhaps inside a PL/SQL procedure or function
 Can also specify SQL_ID
 Still relies on Hard Parse
01/10/2013
show parameter user_dump_dest
ALTER SESSION SET tracefile_identifier='EXAMPLE2_OPTTRACE';
ALTER SESSION SET events 'trace [SQL_Compiler.*][sql:37cv4d33vbu8h]';
SELECT /* EXAMPLE1_2 */ * FROM dual;
ALTER SESSION SET events 'trace [SQL_Compiler.*] off';
 What if you want to trace just one SQL statement and you
don't know which session will execute it?
 Can enable System-wide tracing using ALTER SYSTEM
 Still relies on Hard Parse
01/10/2013
show parameter user_dump_dest
ALTER SYSTEM SET events 'trace [SQL_Compiler.*][sql:bhqn6d93r5r03]';
ALTER SYSTEM SET events 'trace [SQL_Compiler.*] off';
 Solves several issues
 Can show optimizer trace file for a statement that has already been
executed and exists in the cursor cache
 Can force hard parse of the statement
 Can only use Optimizer or Compiler
01/10/2013
BEGIN
dbms_sqldiag.dump_trace(
p_sql_id => '37cv4d33vbu8h',
p_child_number => 0,
p_component => 'Compiler',
p_file_id => 'EXAMPLE1_OPTTRACE');
END;
/
01/10/2013
Enabling tracing for cur#=10 sqlid=8rhfhbwtndmgc recursive
Parsing cur#=10 sqlid=8rhfhbwtndmgc len=61
sql=/* SQL Analyze(216,0) */ SELECT /* EXAMPLE1_2 */ * FROM dual
End parsing of cur#=10 sqlid=8rhfhbwtndmgc
Semantic Analysis cur#=10 sqlid=8rhfhbwtndmgc
OPTIMIZER INFORMATION
******************************************
----- Current SQL Statement for this session (sql_id=8rhfhbwtndmgc) -----
/* SQL Analyze(216,0) */ SELECT /* EXAMPLE1_2 */ * FROM dual
----- PL/SQL Stack -----
----- PL/SQL Call Stack -----
object line object
handle number name
0xee579040 145 package body SYS.DBMS_SQLTUNE_INTERNAL
0xee579040 12085 package body SYS.DBMS_SQLTUNE_INTERNAL
0xee814bc0 1229 package body SYS.DBMS_SQLDIAG
0xe8c34ab0 2 anonymous block
*******************************************
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Many ways of viewing the execution plan used for a
statement
 10046 Trace File
 DBMS_XPLAN - combined with /*+ gather_plan_statistics */
 Real-Time SQL Monitoring
 Modern options allow comparison of Estimated vs. Actual
row source cardinalities
 E-Rows vs. A-Rows
 Experience and data knowledge allow educated guesses
about what is 'going wrong'
01/10/2013
 No real overhead
 Only happens at hard parse
 Sounds crazy, but even if it doesn't help you, it doesn't hurt to
look
 As long as you don't look for too long!
01/10/2013
 You've never wondered why that optimiser won't play?
 Sometimes they are the only way of knowing why the CBO
made a specific decision
 Particularly useful tools here are trace files for 'good' and
'bad' plans and a visual diff tool
 They are a great way of learning about the CBO and
particularly any new features
 Oracle Support/Optimizer Development Group!
01/10/2013
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Standard Trace File Pre-amble
 Query Block Assignment
 SQL Plan Management
 Parallel Query/Auto-DOP
 Predicate Move-Around
 Optimizer Information
 Query Transformations
 Peeked Binds
 Statistics
 Computations – Access Paths and Join Orders
 SQL Statement and Execution Plan dump
01/10/2013
01/10/2013
Trace file
/app/ora/local/admin/TEST1102/diag/rdbms/TEST1102_doug/TEST1102/trace/TEST1102_ora_1
450_DOUG_TEST2.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME = /app/ora/local/product/11.2.0.2/db_4
System name: Linux
Node name: doug
Release: 2.6.18-194.11.4.el5
Version: #1 SMP Fri Sep 17 04:57:05 EDT 2010
Machine: x86_64
Instance name: TEST1102
Redo thread mounted by this instance: 1
Oracle process number: 52
Unix process pid: 1450, image: oracle@doug
*** 2013-03-18 10:59:58.774
*** SESSION ID:(139.79) 2013-03-18 10:59:58.774
*** CLIENT ID:() 2013-03-18 10:59:58.774
*** SERVICE NAME:(SYS$USERS) 2013-03-18 10:59:58.774
*** MODULE NAME:(TOAD 10.6.1.3) 2013-03-18 10:59:58.774
*** ACTION NAME:() 2013-03-18 10:59:58.774
01/10/2013
Registered qb: SEL$1 0xad486a80 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
signature (): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=4 objn=116 hint_alias="DUAL"@"SEL$1"
SPM: statement not found in SMB
**************************
Automatic degree of parallelism (ADOP)
**************************
Automatic degree of parallelism is disabled: Parameter.
PM: Considering predicate move-around in query block SEL$1 (#0)
**************************
Predicate Move-Around (PM)
**************************
01/10/2013
OPTIMIZER INFORMATION
******************************************
----- Current SQL Statement for this session (sql_id=a5ks9fhw2v9s1) -----
select * from dual
*******************************************
Legend
The following abbreviations are used by optimizer trace.
CBQT - cost-based query transformation
JPPD - join predicate push-down
OJPPD - old-style (non-cost-based) JPPD
FPD - filter push-down
PM - predicate move-around
CVM - complex view merging
SPJ - select-project-join
SJC - set join conversion
SU - subquery unnesting
OBYE - order by elimination
OST - old style star transformation
ST - new (cbqt) star transformation
CNT - count(col) to count(*) transformation
JE - Join Elimination
JF - join factorization
SLP - select list pruning
 Oracle 8.1.7 ≈ 50
 Oracle 11.2.0.3 > 300
01/10/2013
***************************************
PARAMETERS USED BY THE OPTIMIZER
********************************
*************************************
PARAMETERS WITH ALTERED VALUES
******************************
Compilation Environment Dump
_pga_max_size = 2097152 KB
*************************************
PARAMETERS WITH DEFAULT VALUES
******************************
Compilation Environment Dump
optimizer_mode_hinted = false
optimizer_features_hinted = 0.0.0
***************************************
PARAMETERS IN OPT_PARAM HINT
****************************
 The Optimizer Development group are Busy Bees!
 As they introduce fixes, they number them and store
information about them in V$SYSTEM_FIX_CONTROL
 Can enable/disable … http://tinyurl.com/5r9zrse
 Coskan Blog Post
01/10/2013
Bug Fix Control Environment
fix 3834770 = 1
fix 3746511 = enabled
fix 4519016 = enabled
fix 3118776 = enabled
fix 4488689 = enabled
fix 2194204 = disabled
fix 2660592 = enabled
01/10/2013
Considering Query Transformations on query block SEL$1 (#0)
**************************
Query transformations (QT)
**************************
JF: Checking validity of join factorization for query block SEL$1 (#0)
JF: Bypassed: not a UNION or UNION-ALL query block.
ST: not valid since star transformation parameter is FALSE
TE: Checking validity of table expansion for query block SEL$1 (#0)
TE: Bypassed: No partitioned table in query block.
CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION
(ALL) queries.
CBQT: Validity checks failed for a5ks9fhw2v9s1.
CSE: Considering common sub-expression elimination in query block SEL$1 (#0)
 Exadata/11g Upgrade project
 optimizer_features_enable – 10.2.0.4
 Cost-based query transformation
 http://tinyurl.com/c6wdhxv - Jonathan Lewis Blog Post
01/10/2013
*************************
Common Subexpression elimination (CSE)
*************************
CSE: CSE not performed on query block SEL$1 (#0).
OBYE: Considering Order-by Elimination from view SEL$1 (#0)
***************************
Order-by elimination (OBYE)
***************************
OBYE: OBYE bypassed: no order by to eliminate.
CVM: Considering view merge in query block SEL$1 (#0)
query block SEL$1 (#0) unchanged
Considering Query Transformations on query block SEL$1 (#0)
**************************
Query transformations (QT)
**************************
JF: Checking validity of join factorization for query block SEL$1 (#0)
JF: Bypassed: not a UNION or UNION-ALL query block.
ST: not valid since star transformation parameter is FALSE
TE: Checking validity of table expansion for query block SEL$1 (#0)
TE: Bypassed: No partitioned table in query block.
CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION
(ALL) queries.
CBQT: Validity checks failed for a5ks9fhw2v9s1.
01/10/2013
SYSTEM STATISTICS INFORMATION
-----------------------------
Using NOWORKLOAD Stats
CPUSPEEDNW: 1416 millions instructions/sec (default is 100)
IOTFRSPEED: 4096 bytes per millisecond (default is 4096)
IOSEEKTIM: 10 milliseconds (default is 10)
MBRC: -1 blocks (default is 32)
***************************************
BASE STATISTICAL INFORMATION
***********************
Table Stats::
Table: DUAL Alias: DUAL
#Rows: 1 #Blks: 1 AvgRowLen: 2.00 ChainCnt: 0.00
Access path analysis for DUAL
***************************************
SINGLE TABLE ACCESS PATH
Single Table Cardinality Estimation for DUAL[DUAL]
Table: DUAL Alias: DUAL
Card: Original: 1.000000 Rounded: 1 Computed: 1.00 Non Adjusted: 1.00
Access Path: TableScan
Cost: 2.00 Resp: 2.00 Degree: 0
Cost_io: 2.00 Cost_cpu: 9893
Resp_io: 2.00 Resp_cpu: 9893
Best:: AccessPath: TableScan
Cost: 2.00 Degree: 1 Resp: 2.00 Card: 1.00 Bytes: 0
01/10/2013
OPTIMIZER STATISTICS AND COMPUTATIONS
***************************************
GENERAL PLANS
***************************************
Considering cardinality-based initial join order.
Permutations for Starting Table :0
Join order[1]: DUAL[DUAL]#0
***********************
Best so far: Table#: 0 cost: 2.0005 card: 1.0000 bytes: 2
***********************
(newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:2000
*********************************
Number of join permutations tried: 1
*********************************
 This is the section that gets very complicated very quickly!
01/10/2013
Plan Table
============
-------------------------------------+-----------------------------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time |
-------------------------------------+-----------------------------------+
| 0 | SELECT STATEMENT | | | | 2 | |
| 1 | TABLE ACCESS FULL | DUAL | 1 | 2 | 2 | 00:00:01 |
-------------------------------------+-----------------------------------+
Content of other_xml column
===========================
db_version : 11.2.0.2
parse_schema : RRS_CORE_DBO
plan_hash : 272002086
plan_hash_2 : 4017058736
Outline Data:
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
DB_VERSION('11.2.0.2')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
FULL(@"SEL$1" "DUAL"@"SEL$1")
END_OUTLINE_DATA
*/
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Introduction
 What
 How
 Why
 Structure
 Example
 Conclusions and References
01/10/2013
 Many ways of viewing the execution plan used for a
statement
 All show you the numbers that the CBO is using and the
resulting plan
 EXPLAIN Plan etc
 Some show you the real numbers
 SQL Monitor Reports and other Plan Statistics approaches
 Only a optimizer trace file can truly show you why there is a
discrepancy
 Sometimes ;-)
01/10/2013
 Cost Based Oracle Fundamentals - Appendix
 Jonathan Lewis
http://tinyurl.com/bxxl6
 Under the hood of the CBO
 Wolfgang Breitling
http://tinyurl.com/bxxl6
 Using new 11g tracing infrastructure to generate files
 Optimizer Development Group (Maria Colgan)
http://tinyurl.com/brcryva and http://tinyurl.com/cr5kz8t
 Greg Rahn
http://tinyurl.com/bupmehx
01/10/2013
 My Blog Posts
 http://oracledoug.com
 Recent Blog Post
 http://jonathanlewis.wordpress.com
 Thanks
 Wolfgang Breitling
 Maria Colgan & Greg Rahn
 Jonathan Lewis
 To you, for listening
01/10/2013
Doug Burns dougburns@yahoo.com
http://oracledoug.com
@orcldoug
#OTW
#OakTable

Mais conteúdo relacionado

Mais procurados

Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Ajith Narayanan
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1Chien Chung Shen
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesBiju Thomas
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWRpasalapudi
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Ajith Narayanan
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Ludovico Caldara
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12cuzzal basak
 
Expert performance tuning tips for Oracle RAC
Expert performance tuning tips for Oracle RACExpert performance tuning tips for Oracle RAC
Expert performance tuning tips for Oracle RACSolarWinds
 
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESLudovico Caldara
 
An introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methodsAn introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methodsAjith Narayanan
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptChien Chung Shen
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - PresentationBiju Thomas
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12cPini Dibask
 
Exadata Smart Scan - What is so smart about it?
Exadata Smart Scan  - What is so smart about it?Exadata Smart Scan  - What is so smart about it?
Exadata Smart Scan - What is so smart about it?Uwe Hesse
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data miningYury Velikanov
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneEnkitec
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresRemote DBA Services
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQLKyle Hailey
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMark Leith
 

Mais procurados (20)

Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New Features
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
Expert performance tuning tips for Oracle RAC
Expert performance tuning tips for Oracle RACExpert performance tuning tips for Oracle RAC
Expert performance tuning tips for Oracle RAC
 
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
 
An introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methodsAn introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methods
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning Concept
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12c
 
Exadata Smart Scan - What is so smart about it?
Exadata Smart Scan  - What is so smart about it?Exadata Smart Scan  - What is so smart about it?
Exadata Smart Scan - What is so smart about it?
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 

Semelhante a 10053 otw

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
Ordina SOFTC Presentation - SQL CLR
Ordina SOFTC Presentation - SQL CLROrdina SOFTC Presentation - SQL CLR
Ordina SOFTC Presentation - SQL CLROrdina Belgium
 
Bypass dbms assert
Bypass dbms assertBypass dbms assert
Bypass dbms assertfangjiafu
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoductionRiyaj Shamsudeen
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersTop 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersIke Ellis
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeMarco Gralike
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3Belal Arfa
 
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormguest785f78
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationBerry Clemens
 
Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9sumsid1234
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
 
Database Foundation Training
Database Foundation TrainingDatabase Foundation Training
Database Foundation TrainingFranky Lao
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)webhostingguy
 
Less04 instance
Less04 instanceLess04 instance
Less04 instanceImran Ali
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbmsjain.pralabh
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 

Semelhante a 10053 otw (20)

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 
Ordina SOFTC Presentation - SQL CLR
Ordina SOFTC Presentation - SQL CLROrdina SOFTC Presentation - SQL CLR
Ordina SOFTC Presentation - SQL CLR
 
Bypass dbms assert
Bypass dbms assertBypass dbms assert
Bypass dbms assert
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersTop 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developers
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3
 
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
 
audit_blog.ppt
audit_blog.pptaudit_blog.ppt
audit_blog.ppt
 
Using AWR for SQL Analysis
Using AWR for SQL AnalysisUsing AWR for SQL Analysis
Using AWR for SQL Analysis
 
Usertracing
UsertracingUsertracing
Usertracing
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentation
 
Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Database Foundation Training
Database Foundation TrainingDatabase Foundation Training
Database Foundation Training
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
 
Less04 instance
Less04 instanceLess04 instance
Less04 instance
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbms
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 

Último

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Último (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

10053 otw

  • 2.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 3.  Who am I?  Why am I talking?  Setting Expectations 01/10/2013
  • 4.  I am Doug  Doug I am << Dr Seuss Edition  Actually I am Douglas  … or, if you're Scottish, Dougie or Doogie  I'm not from England  You will have probably noticed that already  I don't know many Scottish people who do glowing introductions about their all-round genius!  But, amongst other things, I am … 01/10/2013
  • 8.  A long time ago in a galaxy far, far away ….  "A look under the hood of CBO: The 10053 Event"  Wolfgang Breitling (see References)  Time passes & beers are consumed & conversations follow …  You almost never need to use 10053 trace files  They are far too long and complex to understand  … and yet …  I find myself using them more often  I think they're becoming easier to understand 01/10/2013
  • 10.  10053 files, like most Oracle trace files are  Useful in specific situations  Very detailed and informative  Relatively easy to generate  They are also  Usually unnecessary  Undocumented  Subject to change over time  Complex in places 01/10/2013
  • 11.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 12.  Contains a record of the Cost Based Optimizer decision making process and the various inputs used  Hard Parse Time  As we'll see, it contains  Server configuration items that influence the CBO  Object and System Statistics used by calculations  Execution Plan Steps that were considered and accepted ▪ Resulting in final overall execution plan  Execution Plan Steps that were considered and rejected ▪ Including the reasons why 01/10/2013
  • 13.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 14.  By enabling event 10053 using any of the usual methods  Run (or Explain) the SQL statement  Disable event  Find trace file in user_dump_dest 01/10/2013 show parameter user_dump_dest ALTER SESSION SET tracefile_identifier='EXAMPLE1_10053'; ALTER SESSION SET events '10053 trace name context forever, level 1'; SELECT * FROM dual; ALTER SESSION SET events '10053 trace name context off';
  • 15.  The statement must be hard-parsed  The statement must not have been run before  Plan has been aged out of cursor cache  Shared pool has been flushed  New version of the statement by adding a unique comment 01/10/2013 show parameter user_dump_dest ALTER SESSION SET tracefile_identifier='EXAMPLE1_10053_1'; ALTER SESSION SET events '10053 trace name context forever, level 1'; SELECT /* EXAMPLE1_1 */ * FROM dual; ALTER SESSION SET events '10053 trace name context off';
  • 16.  Oracle 11g introduces a new tracing infrastructure  Can be accessed using  ALTER SESSION  ORADEBUG  DBMS_SQLDIAG.DUMP_TRACE ▪ Does not require Diagnostics Pack license 01/10/2013
  • 17.  Replacement for original method of setting event 10053  Main 10053-related Options  SQL_Compiler and SQL_Optimizer 01/10/2013 show parameter user_dump_dest ALTER SESSION SET tracefile_identifier='EXAMPLE1_2_OPTTRACE'; ALTER SESSION SET events 'trace [SQL_Compiler.*]'; SELECT /* EXAMPLE1_2 */ * FROM dual; ALTER SESSION SET events 'trace [SQL_Compiler.*] off';
  • 18.  There are also sub-options 01/10/2013 SQL> oradebug doc component SQL_Compiler SQL_Compiler SQL Compiler SQL_Parser SQL Parser (qcs) SQL_Semantic SQL Semantic Analysis (kkm) SQL_Optimizer SQL Optimizer SQL_Transform SQL Transformation (kkq, vop, nso) SQL_MVRW SQL Materialized View Rewrite SQL_VMerge SQL View Merging (kkqvm) SQL_Virtual SQL Virtual Column (qksvc, kkfi) SQL_APA SQL Access Path Analysis (apa) SQL_Costing SQL Cost-based Analysis (kko, kke) SQL_Parallel_Optimization SQL Parallel Optimization (kkopq) SQL_Code_Generator SQL Code Generator (qka, qkn, qke, kkfd, qkx) SQL_Parallel_Compilation SQL Parallel Compilation (kkfd) SQL_Expression_Analysis SQL Expression Analysis (qke) SQL_Plan_Management SQL Plan Managment (kkopm) MPGE MPGE (qksctx)
  • 19.  What if you want to trace just one SQL statement that a Session executes?  Perhaps inside a PL/SQL procedure or function  Can also specify SQL_ID  Still relies on Hard Parse 01/10/2013 show parameter user_dump_dest ALTER SESSION SET tracefile_identifier='EXAMPLE2_OPTTRACE'; ALTER SESSION SET events 'trace [SQL_Compiler.*][sql:37cv4d33vbu8h]'; SELECT /* EXAMPLE1_2 */ * FROM dual; ALTER SESSION SET events 'trace [SQL_Compiler.*] off';
  • 20.  What if you want to trace just one SQL statement and you don't know which session will execute it?  Can enable System-wide tracing using ALTER SYSTEM  Still relies on Hard Parse 01/10/2013 show parameter user_dump_dest ALTER SYSTEM SET events 'trace [SQL_Compiler.*][sql:bhqn6d93r5r03]'; ALTER SYSTEM SET events 'trace [SQL_Compiler.*] off';
  • 21.  Solves several issues  Can show optimizer trace file for a statement that has already been executed and exists in the cursor cache  Can force hard parse of the statement  Can only use Optimizer or Compiler 01/10/2013 BEGIN dbms_sqldiag.dump_trace( p_sql_id => '37cv4d33vbu8h', p_child_number => 0, p_component => 'Compiler', p_file_id => 'EXAMPLE1_OPTTRACE'); END; /
  • 22. 01/10/2013 Enabling tracing for cur#=10 sqlid=8rhfhbwtndmgc recursive Parsing cur#=10 sqlid=8rhfhbwtndmgc len=61 sql=/* SQL Analyze(216,0) */ SELECT /* EXAMPLE1_2 */ * FROM dual End parsing of cur#=10 sqlid=8rhfhbwtndmgc Semantic Analysis cur#=10 sqlid=8rhfhbwtndmgc OPTIMIZER INFORMATION ****************************************** ----- Current SQL Statement for this session (sql_id=8rhfhbwtndmgc) ----- /* SQL Analyze(216,0) */ SELECT /* EXAMPLE1_2 */ * FROM dual ----- PL/SQL Stack ----- ----- PL/SQL Call Stack ----- object line object handle number name 0xee579040 145 package body SYS.DBMS_SQLTUNE_INTERNAL 0xee579040 12085 package body SYS.DBMS_SQLTUNE_INTERNAL 0xee814bc0 1229 package body SYS.DBMS_SQLDIAG 0xe8c34ab0 2 anonymous block *******************************************
  • 23.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 24.  Many ways of viewing the execution plan used for a statement  10046 Trace File  DBMS_XPLAN - combined with /*+ gather_plan_statistics */  Real-Time SQL Monitoring  Modern options allow comparison of Estimated vs. Actual row source cardinalities  E-Rows vs. A-Rows  Experience and data knowledge allow educated guesses about what is 'going wrong' 01/10/2013
  • 25.  No real overhead  Only happens at hard parse  Sounds crazy, but even if it doesn't help you, it doesn't hurt to look  As long as you don't look for too long! 01/10/2013
  • 26.  You've never wondered why that optimiser won't play?  Sometimes they are the only way of knowing why the CBO made a specific decision  Particularly useful tools here are trace files for 'good' and 'bad' plans and a visual diff tool  They are a great way of learning about the CBO and particularly any new features  Oracle Support/Optimizer Development Group! 01/10/2013
  • 27.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 28.  Standard Trace File Pre-amble  Query Block Assignment  SQL Plan Management  Parallel Query/Auto-DOP  Predicate Move-Around  Optimizer Information  Query Transformations  Peeked Binds  Statistics  Computations – Access Paths and Join Orders  SQL Statement and Execution Plan dump 01/10/2013
  • 29. 01/10/2013 Trace file /app/ora/local/admin/TEST1102/diag/rdbms/TEST1102_doug/TEST1102/trace/TEST1102_ora_1 450_DOUG_TEST2.trc Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options ORACLE_HOME = /app/ora/local/product/11.2.0.2/db_4 System name: Linux Node name: doug Release: 2.6.18-194.11.4.el5 Version: #1 SMP Fri Sep 17 04:57:05 EDT 2010 Machine: x86_64 Instance name: TEST1102 Redo thread mounted by this instance: 1 Oracle process number: 52 Unix process pid: 1450, image: oracle@doug *** 2013-03-18 10:59:58.774 *** SESSION ID:(139.79) 2013-03-18 10:59:58.774 *** CLIENT ID:() 2013-03-18 10:59:58.774 *** SERVICE NAME:(SYS$USERS) 2013-03-18 10:59:58.774 *** MODULE NAME:(TOAD 10.6.1.3) 2013-03-18 10:59:58.774 *** ACTION NAME:() 2013-03-18 10:59:58.774
  • 30. 01/10/2013 Registered qb: SEL$1 0xad486a80 (PARSER) --------------------- QUERY BLOCK SIGNATURE --------------------- signature (): qb_name=SEL$1 nbfros=1 flg=0 fro(0): flg=4 objn=116 hint_alias="DUAL"@"SEL$1" SPM: statement not found in SMB ************************** Automatic degree of parallelism (ADOP) ************************** Automatic degree of parallelism is disabled: Parameter. PM: Considering predicate move-around in query block SEL$1 (#0) ************************** Predicate Move-Around (PM) **************************
  • 31. 01/10/2013 OPTIMIZER INFORMATION ****************************************** ----- Current SQL Statement for this session (sql_id=a5ks9fhw2v9s1) ----- select * from dual ******************************************* Legend The following abbreviations are used by optimizer trace. CBQT - cost-based query transformation JPPD - join predicate push-down OJPPD - old-style (non-cost-based) JPPD FPD - filter push-down PM - predicate move-around CVM - complex view merging SPJ - select-project-join SJC - set join conversion SU - subquery unnesting OBYE - order by elimination OST - old style star transformation ST - new (cbqt) star transformation CNT - count(col) to count(*) transformation JE - Join Elimination JF - join factorization SLP - select list pruning
  • 32.  Oracle 8.1.7 ≈ 50  Oracle 11.2.0.3 > 300 01/10/2013 *************************************** PARAMETERS USED BY THE OPTIMIZER ******************************** ************************************* PARAMETERS WITH ALTERED VALUES ****************************** Compilation Environment Dump _pga_max_size = 2097152 KB ************************************* PARAMETERS WITH DEFAULT VALUES ****************************** Compilation Environment Dump optimizer_mode_hinted = false optimizer_features_hinted = 0.0.0 *************************************** PARAMETERS IN OPT_PARAM HINT ****************************
  • 33.  The Optimizer Development group are Busy Bees!  As they introduce fixes, they number them and store information about them in V$SYSTEM_FIX_CONTROL  Can enable/disable … http://tinyurl.com/5r9zrse  Coskan Blog Post 01/10/2013 Bug Fix Control Environment fix 3834770 = 1 fix 3746511 = enabled fix 4519016 = enabled fix 3118776 = enabled fix 4488689 = enabled fix 2194204 = disabled fix 2660592 = enabled
  • 34. 01/10/2013 Considering Query Transformations on query block SEL$1 (#0) ************************** Query transformations (QT) ************************** JF: Checking validity of join factorization for query block SEL$1 (#0) JF: Bypassed: not a UNION or UNION-ALL query block. ST: not valid since star transformation parameter is FALSE TE: Checking validity of table expansion for query block SEL$1 (#0) TE: Bypassed: No partitioned table in query block. CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION (ALL) queries. CBQT: Validity checks failed for a5ks9fhw2v9s1. CSE: Considering common sub-expression elimination in query block SEL$1 (#0)  Exadata/11g Upgrade project  optimizer_features_enable – 10.2.0.4  Cost-based query transformation  http://tinyurl.com/c6wdhxv - Jonathan Lewis Blog Post
  • 35. 01/10/2013 ************************* Common Subexpression elimination (CSE) ************************* CSE: CSE not performed on query block SEL$1 (#0). OBYE: Considering Order-by Elimination from view SEL$1 (#0) *************************** Order-by elimination (OBYE) *************************** OBYE: OBYE bypassed: no order by to eliminate. CVM: Considering view merge in query block SEL$1 (#0) query block SEL$1 (#0) unchanged Considering Query Transformations on query block SEL$1 (#0) ************************** Query transformations (QT) ************************** JF: Checking validity of join factorization for query block SEL$1 (#0) JF: Bypassed: not a UNION or UNION-ALL query block. ST: not valid since star transformation parameter is FALSE TE: Checking validity of table expansion for query block SEL$1 (#0) TE: Bypassed: No partitioned table in query block. CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION (ALL) queries. CBQT: Validity checks failed for a5ks9fhw2v9s1.
  • 36. 01/10/2013 SYSTEM STATISTICS INFORMATION ----------------------------- Using NOWORKLOAD Stats CPUSPEEDNW: 1416 millions instructions/sec (default is 100) IOTFRSPEED: 4096 bytes per millisecond (default is 4096) IOSEEKTIM: 10 milliseconds (default is 10) MBRC: -1 blocks (default is 32) *************************************** BASE STATISTICAL INFORMATION *********************** Table Stats:: Table: DUAL Alias: DUAL #Rows: 1 #Blks: 1 AvgRowLen: 2.00 ChainCnt: 0.00 Access path analysis for DUAL *************************************** SINGLE TABLE ACCESS PATH Single Table Cardinality Estimation for DUAL[DUAL] Table: DUAL Alias: DUAL Card: Original: 1.000000 Rounded: 1 Computed: 1.00 Non Adjusted: 1.00 Access Path: TableScan Cost: 2.00 Resp: 2.00 Degree: 0 Cost_io: 2.00 Cost_cpu: 9893 Resp_io: 2.00 Resp_cpu: 9893 Best:: AccessPath: TableScan Cost: 2.00 Degree: 1 Resp: 2.00 Card: 1.00 Bytes: 0
  • 37. 01/10/2013 OPTIMIZER STATISTICS AND COMPUTATIONS *************************************** GENERAL PLANS *************************************** Considering cardinality-based initial join order. Permutations for Starting Table :0 Join order[1]: DUAL[DUAL]#0 *********************** Best so far: Table#: 0 cost: 2.0005 card: 1.0000 bytes: 2 *********************** (newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:2000 ********************************* Number of join permutations tried: 1 *********************************  This is the section that gets very complicated very quickly!
  • 38. 01/10/2013 Plan Table ============ -------------------------------------+-----------------------------------+ | Id | Operation | Name | Rows | Bytes | Cost | Time | -------------------------------------+-----------------------------------+ | 0 | SELECT STATEMENT | | | | 2 | | | 1 | TABLE ACCESS FULL | DUAL | 1 | 2 | 2 | 00:00:01 | -------------------------------------+-----------------------------------+ Content of other_xml column =========================== db_version : 11.2.0.2 parse_schema : RRS_CORE_DBO plan_hash : 272002086 plan_hash_2 : 4017058736 Outline Data: /*+ BEGIN_OUTLINE_DATA IGNORE_OPTIM_EMBEDDED_HINTS OPTIMIZER_FEATURES_ENABLE('11.2.0.2') DB_VERSION('11.2.0.2') ALL_ROWS OUTLINE_LEAF(@"SEL$1") FULL(@"SEL$1" "DUAL"@"SEL$1") END_OUTLINE_DATA */
  • 39.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 40.  Introduction  What  How  Why  Structure  Example  Conclusions and References 01/10/2013
  • 41.  Many ways of viewing the execution plan used for a statement  All show you the numbers that the CBO is using and the resulting plan  EXPLAIN Plan etc  Some show you the real numbers  SQL Monitor Reports and other Plan Statistics approaches  Only a optimizer trace file can truly show you why there is a discrepancy  Sometimes ;-) 01/10/2013
  • 42.  Cost Based Oracle Fundamentals - Appendix  Jonathan Lewis http://tinyurl.com/bxxl6  Under the hood of the CBO  Wolfgang Breitling http://tinyurl.com/bxxl6  Using new 11g tracing infrastructure to generate files  Optimizer Development Group (Maria Colgan) http://tinyurl.com/brcryva and http://tinyurl.com/cr5kz8t  Greg Rahn http://tinyurl.com/bupmehx 01/10/2013
  • 43.  My Blog Posts  http://oracledoug.com  Recent Blog Post  http://jonathanlewis.wordpress.com  Thanks  Wolfgang Breitling  Maria Colgan & Greg Rahn  Jonathan Lewis  To you, for listening 01/10/2013