18
Performance Tuning Performance Tuning Compiled from: Compiled from: Oracle Database Administration, Session 13, Performance, Oracle Database Administration, Session 13, Performance, Harvard U Harvard U Oracle Server Tuning Accelerator, David Scott, Intec Oracle Server Tuning Accelerator, David Scott, Intec

8. Performance Tuning PartI

Embed Size (px)

DESCRIPTION

bases

Citation preview

  • Performance TuningCompiled from:Oracle Database Administration, Session 13, Performance, Harvard UOracle Server Tuning Accelerator, David Scott, Intec

  • Case Study #1Define the BUSINESS problemThe GUI is too slow; a loss in productivity $$$Measure the painScreen XYZ in the GUI takes 47 seconds3000 users use this screen at each loginMost other screens are fineIdentify the problem componentStopwatch timing of XYZ response is 47 secondsSame SQL query takes 47 secondsQuery identified as culprit

  • Case Study #1 (contd)Find the root causeInefficient queryInvestigate and weigh solutionsMultiple versions of query comparedResults must match originalFix the problemReplace query in Screen XYZ with tuned versionMeasure the resultsQuery returns in 2 secondsROI: 3000 users * 45 seconds saved * Avg salary @ $10/hour * 260 business days/year = $97,500

  • Performance TuningTrade-offs Between Response Time and ThroughputGoals for tuning vary, depending on the needs of the applicationOLTP vs. OLAP applications (which one requires which performance?)

  • Performance DefinitionResponse time = service time + wait timeWe can increase performance two ways: by reducing service time by reducing wait time

  • Performance DefinitionSystem throughput equals the amount of work accomplished in a given amount of timeTwo techniques of increasing throughput existGet more work done with the same resources (reduce service time)Get the work done quicker by reducing overall response time (reduce wait time)

  • Performance DefinitionThe service time for a task may stay the same, but wait time increases as contention increasesIf many users are waiting for a service that takes 1 second, then the tenth user must wait 9 seconds for a service that takes 1 second

  • Wheres the Wait?Client ApplicationNetworkDisk

    CPUDatabase

  • Critical ResourcesResources such as CPUs, memory, I/O capacity, and network bandwidth are key to reducing service timeAdding resources can give higher throughput and swifter response times

  • SQL Processing Architecture

  • ParserThe parser performs two functions:Syntax analysis: This checks SQL statements for correct syntaxSemantic analysis: Checks that the current database objects and object attributes are correct

  • OptimizerThe optimizer is the heart of the SQL processing engine. The Oracle server provides two methods of optimization: rule-based optimizer (RBO) and cost-based optimizer (CBO).Note: As of Oracle 10g, RBO is no longer supported.

  • Row Source GeneratorThe row source generator receives the optimal plan from the optimizerIt outputs the execution plan for the SQL statement A set of rows returned by an execution step is called a row sourceThe execution plan is a collection of row sources, structured in the form of a tree

  • SQL ExecutionThe combination of steps required to execute a statement is called an execution planAn execution plan includes an access method for each table that the statement accesses and an ordering of the tables (the join order)

  • Example 1How will the following SQL statement be processed?SELECT *FROM BLLIM.Project;

    Does it matter if an index exists?

  • Example 2How will the following SQL statement be processed?SELECT *FROM BLLIM.ProjectWHERE status = C; // C for complete

    Does it matter if an index exists?

  • Example 3How will the following SQL statement be processed?SELECT *FROM BLLIM.ProjectWHERE status = C; // C for complete

    Does it matter if an index exists?What if the distribution of status is the following (skewed)?70 projects have C, 10 have I, and 20 have A

  • Example 4How will the following SQL statement be processed?SELECT pjTitleFROM BLLIM.ProjectWHERE status = C; // C for complete

    Does it matter if an index exists?Assume that you have an index for status and another one for pjTitle.