➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
261197832 8-performance-tuning-part i
1. Performance TuningPerformance Tuning
Compiled from:Compiled from:
Oracle Database Administration, Session 13, Performance, Harvard UOracle Database Administration, Session 13, Performance, Harvard U
Oracle Server Tuning Accelerator, David Scott, IntecOracle Server Tuning Accelerator, David Scott, Intec
2. Case Study #1Case Study #1
• Define the BUSINESS problemDefine the BUSINESS problem
– The GUI is too slow; a loss in productivity $$$The GUI is too slow; a loss in productivity $$$
• Measure the painMeasure the pain
– Screen XYZ in the GUI takes 47 secondsScreen XYZ in the GUI takes 47 seconds
– 3000 users use this screen at each login3000 users use this screen at each login
– Most other screens are fineMost other screens are fine
• Identify the problem componentIdentify the problem component
– Stopwatch timing of XYZ response is 47 secondsStopwatch timing of XYZ response is 47 seconds
– Same SQL query takes 47 secondsSame SQL query takes 47 seconds
– Query identified as culpritQuery identified as culprit
3. Case Study #1 (cont’d)Case Study #1 (cont’d)
• Find the root causeFind the root cause
– Inefficient queryInefficient query
• Investigate and weigh solutionsInvestigate and weigh solutions
– Multiple versions of query comparedMultiple versions of query compared
– Results must match originalResults must match original
• Fix the problemFix the problem
– Replace query in Screen XYZ with tuned versionReplace query in Screen XYZ with tuned version
• Measure the resultsMeasure the results
– Query returns in 2 secondsQuery returns in 2 seconds
– ROI: 3000 users * 45 seconds saved * Avg salary @ROI: 3000 users * 45 seconds saved * Avg salary @
$10/hour * 260 business days/year =$10/hour * 260 business days/year = $97,500$97,500
4. Performance TuningPerformance Tuning
• Trade-offs Between Response Time andTrade-offs Between Response Time and
ThroughputThroughput
• Goals for tuning vary, depending on theGoals for tuning vary, depending on the
needs of the applicationneeds of the application
– OLTP vs. OLAP applications (which oneOLTP vs. OLAP applications (which one
requires which performance?)requires which performance?)
5. Performance DefinitionPerformance Definition
• Response time = service time + waitResponse time = service time + wait
timetime
• We can increase performance two ways:We can increase performance two ways:
– by reducing service timeby reducing service time
– by reducing wait timeby reducing wait time
6. Performance DefinitionPerformance Definition
• System throughput equals the amount ofSystem throughput equals the amount of
work accomplished in a given amount ofwork accomplished in a given amount of
timetime
• Two techniques of increasing throughputTwo techniques of increasing throughput
existexist
– Get more work done with the same resourcesGet more work done with the same resources
((reduce service timereduce service time))
– Get the work done quicker by reducing overallGet the work done quicker by reducing overall
response time (response time (reduce wait timereduce wait time))
7. Performance DefinitionPerformance Definition
• The service time for a task may stay theThe service time for a task may stay the
same, but wait time increases assame, but wait time increases as
contention increasescontention increases
• If many users are waiting for a service thatIf many users are waiting for a service that
takes 1 second, then the tenth user musttakes 1 second, then the tenth user must
wait 9 seconds for a service that takes 1wait 9 seconds for a service that takes 1
secondsecond
9. Critical ResourcesCritical Resources
• Resources such as CPUs, memory, I/OResources such as CPUs, memory, I/O
capacity, and network bandwidth are keycapacity, and network bandwidth are key
to reducing service timeto reducing service time
• Adding resourcesAdding resources cancan give highergive higher
throughput and swifter response timesthroughput and swifter response times
11. ParserParser
• The parser performs two functions:The parser performs two functions:
– Syntax analysisSyntax analysis: This checks SQL statements: This checks SQL statements
for correct syntaxfor correct syntax
– Semantic analysisSemantic analysis: Checks that the current: Checks that the current
database objects and object attributes aredatabase objects and object attributes are
correctcorrect
12. OptimizerOptimizer
• The optimizer is the heart of the SQLThe optimizer is the heart of the SQL
processing engine. The Oracle serverprocessing engine. The Oracle server
provides two methods of optimization:provides two methods of optimization:
rule-based optimizer (RBO) and cost-rule-based optimizer (RBO) and cost-
based optimizer (CBO).based optimizer (CBO).
• Note: As of Oracle 10g, RBO is no longerNote: As of Oracle 10g, RBO is no longer
supported.supported.
13. Row Source GeneratorRow Source Generator
• The row source generator receives theThe row source generator receives the
optimal plan from the optimizeroptimal plan from the optimizer
• It outputs the execution plan for the SQLIt outputs the execution plan for the SQL
statementstatement
• A set of rows returned by an executionA set of rows returned by an execution
step is called astep is called a row sourcerow source
• The execution plan is a collection of rowThe execution plan is a collection of row
sources, structured in the form of a treesources, structured in the form of a tree
14. SQL ExecutionSQL Execution
• The combination of steps required toThe combination of steps required to
execute a statement is called anexecute a statement is called an
execution planexecution plan
• An execution plan includes an accessAn execution plan includes an access
method for each table that the statementmethod for each table that the statement
accesses and an ordering of the tablesaccesses and an ordering of the tables
(the join order)(the join order)
15. Example 1Example 1
• How will the following SQL statement beHow will the following SQL statement be
processed?processed?
– SELECT *SELECT *
– FROM BLLIM.Project;FROM BLLIM.Project;
• Does it matter if an index exists?Does it matter if an index exists?
16. Example 2Example 2
• How will the following SQL statement beHow will the following SQL statement be
processed?processed?
– SELECT *SELECT *
– FROM BLLIM.ProjectFROM BLLIM.Project
– WHERE status = ‘C’; // ‘C’ for completeWHERE status = ‘C’; // ‘C’ for complete
• Does it matter if an index exists?Does it matter if an index exists?
17. Example 3Example 3
• How will the following SQL statement beHow will the following SQL statement be
processed?processed?
– SELECT *SELECT *
– FROM BLLIM.ProjectFROM BLLIM.Project
– WHERE status = ‘C’; // ‘C’ for completeWHERE status = ‘C’; // ‘C’ for complete
• Does it matter if an index exists?Does it matter if an index exists?
• What if the distribution of status is the followingWhat if the distribution of status is the following
(skewed)?(skewed)?
– 70 projects have ‘C’, 10 have ‘I’, and 20 have ‘A’70 projects have ‘C’, 10 have ‘I’, and 20 have ‘A’
18. Example 4Example 4
• How will the following SQL statement beHow will the following SQL statement be
processed?processed?
– SELECT pjTitleSELECT pjTitle
– FROM BLLIM.ProjectFROM BLLIM.Project
– WHERE status = ‘C’; // ‘C’ for completeWHERE status = ‘C’; // ‘C’ for complete
• Does it matter if an index exists?Does it matter if an index exists?
• Assume that you have an index for status andAssume that you have an index for status and
another one for pjTitle.another one for pjTitle.