Performance Tuning Compiled from: Oracle Database Administration ...

777 views
723 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
777
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
53
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Performance Tuning Compiled from: Oracle Database Administration ...

  1. 1. Performance Tuning Compiled from: Oracle Database Administration, Session 13, Performance, Harvard U Oracle Server Tuning Accelerator, David Scott, Intec
  2. 2. Case Study #1 <ul><li>Define the BUSINESS problem </li></ul><ul><ul><li>The GUI is too slow; a loss in productivity $$$ </li></ul></ul><ul><li>Measure the pain </li></ul><ul><ul><li>Screen XYZ in the GUI takes 47 seconds </li></ul></ul><ul><ul><li>3000 users use this screen at each login </li></ul></ul><ul><ul><li>Most other screens are fine </li></ul></ul><ul><li>Identify the problem component </li></ul><ul><ul><li>Stopwatch timing of XYZ response is 47 seconds </li></ul></ul><ul><ul><li>Same SQL query takes 47 seconds </li></ul></ul><ul><ul><li>Query identified as culprit </li></ul></ul>
  3. 3. Case Study #1 (cont’d) <ul><li>Find the root cause </li></ul><ul><ul><li>Inefficient query </li></ul></ul><ul><li>Investigate and weigh solutions </li></ul><ul><ul><li>Multiple versions of query compared </li></ul></ul><ul><ul><li>Results must match original </li></ul></ul><ul><li>Fix the problem </li></ul><ul><ul><li>Replace query in Screen XYZ with tuned version </li></ul></ul><ul><li>Measure the results </li></ul><ul><ul><li>Query returns in 2 seconds </li></ul></ul><ul><ul><li>ROI: 3000 users * 45 seconds saved * Avg salary @ $10/hour * 260 business days/year = $97,500 </li></ul></ul>
  4. 4. Performance Tuning <ul><li>Trade-offs Between Response Time and Throughput </li></ul><ul><li>Goals for tuning vary, depending on the needs of the application </li></ul><ul><ul><li>OLTP vs. OLAP applications (which one requires which performance?) </li></ul></ul>
  5. 5. Performance Definition <ul><li>Response time = service time + wait time </li></ul><ul><li>We can increase performance two ways: </li></ul><ul><ul><li>by reducing service time </li></ul></ul><ul><ul><li>by reducing wait time </li></ul></ul>
  6. 6. Performance Definition <ul><li>System throughput equals the amount of work accomplished in a given amount of time </li></ul><ul><li>Two techniques of increasing throughput exist </li></ul><ul><ul><li>Get more work done with the same resources ( reduce service time ) </li></ul></ul><ul><ul><li>Get the work done quicker by reducing overall response time ( reduce wait time ) </li></ul></ul>
  7. 7. Performance Definition <ul><li>The service time for a task may stay the same, but wait time increases as contention increases </li></ul><ul><li>If 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 </li></ul>
  8. 8. Where’s the Wait? Client Application Network Disk CPU Database
  9. 9. Critical Resources <ul><li>Resources such as CPUs, memory, I/O capacity, and network bandwidth are key to reducing service time </li></ul><ul><li>Adding resources can give higher throughput and swifter response times </li></ul>
  10. 10. SQL Processing Architecture
  11. 11. Parser <ul><li>The parser performs two functions: </li></ul><ul><ul><li>Syntax analysis : This checks SQL statements for correct syntax </li></ul></ul><ul><ul><li>Semantic analysis : Checks that the current database objects and object attributes are correct </li></ul></ul>
  12. 12. Optimizer <ul><li>The 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). </li></ul><ul><li>Note: As of Oracle 10g, RBO is no longer supported. </li></ul>
  13. 13. Row Source Generator <ul><li>The row source generator receives the optimal plan from the optimizer </li></ul><ul><li>It outputs the execution plan for the SQL statement </li></ul><ul><li>A set of rows returned by an execution step is called a row source </li></ul><ul><li>The execution plan is a collection of row sources, structured in the form of a tree </li></ul>
  14. 14. SQL Execution <ul><li>The combination of steps required to execute a statement is called an execution plan </li></ul><ul><li>An execution plan includes an access method for each table that the statement accesses and an ordering of the tables (the join order) </li></ul>
  15. 15. Example 1 <ul><li>How will the following SQL statement be processed? </li></ul><ul><ul><li>SELECT * </li></ul></ul><ul><ul><li>FROM BLLIM.Project; </li></ul></ul><ul><li>Does it matter if an index exists? </li></ul>
  16. 16. Example 2 <ul><li>How will the following SQL statement be processed? </li></ul><ul><ul><li>SELECT * </li></ul></ul><ul><ul><li>FROM BLLIM.Project </li></ul></ul><ul><ul><li>WHERE status = ‘C’; // ‘C’ for complete </li></ul></ul><ul><li>Does it matter if an index exists? </li></ul>
  17. 17. Example 3 <ul><li>How will the following SQL statement be processed? </li></ul><ul><ul><li>SELECT * </li></ul></ul><ul><ul><li>FROM BLLIM.Project </li></ul></ul><ul><ul><li>WHERE status = ‘C’; // ‘C’ for complete </li></ul></ul><ul><li>Does it matter if an index exists? </li></ul><ul><li>What if the distribution of status is the following (skewed)? </li></ul><ul><ul><li>70 projects have ‘C’, 10 have ‘I’, and 20 have ‘A’ </li></ul></ul>
  18. 18. Example 4 <ul><li>How will the following SQL statement be processed? </li></ul><ul><ul><li>SELECT pjTitle </li></ul></ul><ul><ul><li>FROM BLLIM.Project </li></ul></ul><ul><ul><li>WHERE status = ‘C’; // ‘C’ for complete </li></ul></ul><ul><li>Does it matter if an index exists? </li></ul><ul><li>Assume that you have an index for status and another one for pjTitle. </li></ul>

×