This action might not be possible to undo. Are you sure you want to continue?
Ankit Kadvani Enrollment:- 095030693008 Guided by:- Mr Bhavin Tanna (OCE)
Flow of Dissertation
Abstract Introduction Literature Survey Automatic SQL Tuning Architecture SQL Profiling
Access Path Analysis
SQL Structure Analysis Automatic SQL Tuning in the Oracle10g Self Managing Database Experimental Results
SQL Tuning is critical activity, time consuming task. DBA must be expert even thou “human error” chances.
Oracle 10g offers a comprehensive solution, known as Automatic SQL Tuning.
Introduction Basic steps of SQL tuning: – Identify high load statements – Find ways to improve execution plans – Implement “corrective actions” Corrective action include: – query optimizer to select better plan* – Rewrite the SQL statement – Create data access structure(access path) Challenging task even for a tuning expert Many third party tool but lack of internal knowhow 2•4 .
Automatic SQL Tuning = Oracle query optimizer itself in “special mode” In running in this mode. the Oracle query optimizer is referred to as the Automatic Tuning Optimizer MD = MBBS Natural extension of the Oracle query optimizer Run for a much longer period of time 2•5 .
Quick Snapshot of Automatic SQL Tuning Step 0:Automatic SQL Tuning can be invoked through a server utility called SQL Tuning Advisor using Oracle Enterprise Manager Step 1: First logon to Oracle Enterprise Manager 10g. 2•6 .
This view is very helpful in understanding the overall performance of the instance. Step2: Once logged in to OEM you will be presented with a dash board view of your instance. 2•8 .
2•9 . Step3: In the Related Links section below click on Advisor Central to navigate to the Advisor Central home page.
Click on SQL Tuning Advisor link under Advisors to identify all the sources (listed below) that you can use to run SQL Tuning advisor on. Once you created SQL Tuning Set you can run SQL Tuning Advisor on it by clicking on “Schedule SQL Tuning Advisor” link. Snapshots. Preserved Snapshot Sets. SQL Tuning Sets. Top Activity. Period SQL. Step4: From the Advisor Central home page. 2 • 10 .
2 • 11 .
Step5: If you prefer running SQL Tuning Advisor on single SQL statement then just click the particular SQL and then click Schedule SQL Tuning Advisor. You can name SQL Tuning session with your custom name 2 • 12 .
2 • 13 .
Step6: Once you run the SQL Tuning Advisor it will create a task and give recommendations for the SQL as below. In this case advisor has recommended a SQL Profile and also to restructure the SQL. You can view the recommendations by clicking on View Recommendations link to see them in detail. 2 • 14 .
2 • 15 .
2 • 16 . Step7: review the recommendations and decide what you want to implement Step8: After implementing the SQL profile retest the query to see if it has helped in performance.
Automatic SQL Tuning Architecture 2 • 17 .
The Automatic Database Diagnostic Monitor (ADDM) proactively identifies high-load SQL statements which are good candidates for SQL tuning Displayed to user by SQL Tuning Advisor as “tuning advices” 2 • 18 .
SQL Profiling Automatic Tuning Optimizer relies on data and system statistics to function properly Ex of Data Need: estimate cost – it uses the number of blocks and number of rows. SQL Profile consist of auxiliary statistics specific to SQL statement Why profile : – Missing or stale base statistics – Wrong estimation of intermediate result sizes – Inappropriate optimization parameter settings How to Create Profile(plan generation) : – – – Statistic Analysis Estimate Analysis Parameter Analysis 2 • 19 .
all operation log stored in Column and at last column is compared with source object. statistics analysis phase produces two kinds of output: – Recommendations to gather statistics for the objects that are found to have either no statistics or stale(inaccurate) statistics. if user rejects above. Query optimizer logs the types of statistics used.Statistics Analysis Watchmen checking whether statistics are neither missing nor stale.. – Auxiliary information(Generalized) to supply missing statistics or correct stale statistics 2 • 20 .
Estimate Analysis Watchmen to find error in estimates of the size of results Error in estimates: – Wrong statistical method for complex Predicate – Wrong data distribution assumption – Unaware of correlation 2 • 21 .
Parameter Settings Analysis Determine the correct optimizer settings Past execution statistic are stored in Automatic Workload Repository(AWR) 2 • 22 .
SQL Profile 2 • 23 .
2 • 24 . when the query performance can be improved by a large factor Next to verify their effectiveness Show recommendation running the SQL Access Advisor.Access Path Analysis Creating suitable indexes is a well-known tuning technique recommends the creation of indexes based on what-if analysis of various predicates and clauses present in the SQL statement being tuned.
And provide annotation that help execution plan creation 2 • 25 . some are semantics-based. and some are purely design issues.SQL Structure Analysis How to write SQL statements that produce desired results Structure analysis refers selection There are various reasons related to the structure of a SQL statement that can cause poor performance. Some reasons are syntax-based.
– ADDM (Automatic Database Diagnostic Monitor). 2 • 26 . – and Resolve. – Diagnose. – and STB (SQL Tuning Base). – STS (SQL Tuning Set). self-managing loop include: – Observe.Automatic SQL Tuning in the Oracle10g Self Managing Database Goal is to provide an end-to-end solution to the many SQL tuning challenges faced by DBA and developer four key manageability components: – AWR (Automatic Workload Repository).
2 • 27 .
– collection is referred to as a snapshot – and captures top SQL statements 2 • 28 . Observe – data needed for analysis – monitoring and tuning – lightweight comprehensive data collection – Chief Component Automatic Workload Repository (AWR).
. a SQL Tuning Set becomes the main input of the SQL Tuning Advisor. Also include user stated set of statement(right side arrow) 2 • 29 – to create and manage the SQL workload to tune is have SQL Tuning Set (STS) – stores one or more SQL statements – enables the system to repeat the runtime environment under which the SQL statement was detected – Once created and populated. Diagnose – Chief component is ADDM – Identifies the root causes of the top SQL.
it is stored in the SQL Tuning Base (STB) 2 • 30 . Resolve – provide as output a set of recommendations that need to be implemented or applied to the database – action part includes accepting SQL Profiles recommended – accepted.
Experimental Results 2 • 31 .
VolkerMarkl.leccotech. Lohman. LECCOTECH Performance Optimization Solutions for Oracle. 2003. Mokhtar Kandil: LEO œ DB2„s Learning Optimizer. 1997. 2 • 32 .  V.com. Raman: LEO: An autonomic query optimizer for DB2.  Leccotech. G. Guy M. Chaudhuri.M. V.com. 23rdInternational Conference on Very Large Data Bases. Quest Central for Oracle: SQLab Vision. 2003. Cost-driven Index Tuning Wizard for Microsoft SQL Server. Vol 42.com/.  Oracle Corporation: Performance Tuning using the SQL Access Advisor. No 1. Markl.  Quest Software. Oracle White Paper.oracle. http://otn. Lohman. 2001. 2003. http://www.  S. The VLDB Journal.quest. http://www. 2003. IBM Systems Journal. White Paper.References  Michael Stillger. V. Narasayya: An Efficient.
Alan Skelley: DB2 Advisor: An Optimizer Smart Enough to Recommend Its Own Indexes.com.com. Joseph Hellerstein. Daniel Zilio.com. Guy Lohman. ACM SIGMOD Conference. Michael Zuliani. 2003.oracle. Oracle White Paper. 2 • 33 .  Oracle Corporation: The Self-Managing Database: Automatic Performance Diagnosis.  Oracle Corporation: Database 10g: The Self-Managing Database. 2003. Oracle White Paper.oracle. Waqar Hasan: Extensible/Rule Based Query Rewrite Optimization in Starburst. http://otn. 2003. Oracle White Paper.  Oracle Corporation: The Self-Managing Database: Guided Application and SQL Tuning. 2000.oracle. 16th International Conference on Data Engineering. 1992.  Gary Valentin. http://otn.  Hamid Pirahesh. http://otn.