SlideShare uma empresa Scribd logo
1 de 95
Baixar para ler offline
Are you a monkey or an
astronaut?

The Oracle Advisors from
a different perspective.



Karen Morton
karen.morton@method-r.com
Your speaker…

• Karen Morton
   – Educator, DBA, developer,
     consultant, researcher, author,
     speaker, …
   – Director
   – Software, education, consulting   Committed to genuinely satisfying
                                           software performance
• Come see us…
   – method-r.com
   – karenmorton.blogspot.com
   – An Oracle user group near you
Agenda

•   Introduction
•   The “Self-Managing” Database
•   Before and After
•   What do we really want?
•   When the Advisors mislead
•   It takes human intelligence
•   Conclusion
•   Q&A
It is impossible to underrate
human intelligence – beginning
         with one’s own.

       Henry Brooks Adams
Introduction
Do you remember?
What about these guys?
Monkeys were first
Are you a monkey?
Or, are you an astronaut?
The Self-Managing
Database
The Oracle Advisors
Database performance optimization is
 a “complex, time consuming task and
     requires expensive specialist
     consulting skills” to perform
Performance diagnosis and tuning
is mostly about following a logical,
methodical approach. Fortunately
computers are pretty good at that!
           Graham Wood & Kyle Hailey
What role will we choose
          and
   what is the risk?
DBA
      x

The system is slow!
                   !
 Please fix it now


                 x
How would you diagnose the problem?
1) Check server to determine if adequate
        resources are available
2) Check database and notice many sessions
      are waiting on “latch free” waits
3) Drilling down into latches shows most are on
   “library cache” and “shared pool” latches
4) From knowledge, experience and reference
books, you know these latches are associated
           with hard parsing issues
5) Double-check the hypothesis that hard
   parsing is the problem by looking at
 the rate at which “parse time elapsed”
   and “parse time cpu” are increasing
6) Now determine if one or more sessions are
   responsible for the majority of the hard
  parses or check shared pool for existence
    of many similar statements with the
               same SQL plan
7) By looking at the shared pool, you find there
   are a small number of plans each of which
  has many different SQL texts associated
      with it (they differ only by a literal)
8) Now the problem is identified and
    you can move on to fixing it
With ADDM, how would the problem
      have been diagnosed?
ADDM says…

 SQL statements were not shared due
 to usage of literals. This
 resulted in additional hard parses
 which were consuming significant
 database time.
ADDM recommends…

 ACTION: Investigate application
 logic for possible use of bind
 variables instead of literals.
 Alternatively, you may set the
 parameter CURSOR_SHARING to FORCE.
…because…

 RATIONALE: SQL statements with
 PLAN_HASH_VALUE 3106087033 were
 found to be using literals. Look
 in V$SQL for examples of such SQL
 statements.
Without ADDM                             With ADDM
• Multiple investigative steps must be   • Consult the latest ADDM report
  completed                              • No mention of latching at all in the
• Must have knowledge of what latch        report
  free waits indicate                    • Exact SQL identified with
• Must locate the problem SQL              PLAN_HASH_VALUE
• Requires executing queries against     • No additional overhead needed as
  database that add overhead to the        report is based on previously
  system                                   collected snapshot data



            Given this example, which method
             of diagnosis would you prefer?
ADDM did a great job!
Who wouldn’t want to spend
less time getting to the root
     cause of a problem?
But…
Could you have diagnosed
the problem without ADDM?
If you could have diagnosed
the problem, would using ADDM
       have been quicker
    (and therefore, better)?
What would you have done if you
fixed the problem as described
 by ADDM, but the user says
       “it’s still slow”?
Instead of using the human brain,
humans have created another brain
to do the job. There is nothing
around us that is not built to cater
to the needs of the human race and
to ease off the duties of what the
human brain is supposed to do; for
instance, thinking. Is laziness going
to be the death of the human race?
                     Kurt Vonnegut
What do we really want?
A magic formula?
A checklist, a “how-to”, a tool
    or some secret parameter?



alter system set fast = true;
What most people really want is
       knowledge and experience




…that allows us to confidently
      approach a problem and
            solve it efficiently
We want training that teaches us
    how and why things work as they do




…and teaches us how to “know”
   what to do and how to do it
         when problems arise
The part of intuition that involves pattern
matching and recognition of familiar and
typical cases can be trained. If you want people
to size up situations quickly and accurately,
you need to expand their experience base. One
way is to arrange for a person to receive more
difficult cases.
                                  Gary Klein



…or simply have them become an Oracle DBA
or developer.
When the advisors
mislead
What would you do if the problem
isn’t resolved via the advisors?
The advisors aren’t true artificial intelligence
They can only pattern match,
aggregate and assimilate answers
 based on programmed heuristics
They can only suggest solutions
    within a realm of known
   (i.e. built-in) possibilities
They can’t rewrite code
They can miss something or “get it wrong”
It takes human intelligence
SQL Tuning Advisor vs. Human
Example
So, how did the SQL Advisor do?
Let’s compare using AUTOTRACE
Elapsed: 00:00:01.51
--------------------------------------------------------------------------------------
| Id | Operation                  | Name     | Rows | Bytes | Cost (%CPU)| Time      |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT          |          |   160 | 2560 |    191 (78)| 00:00:03 |
|   1 | SORT UNIQUE               |          |   160 | 2560 |    191 (78)| 00:00:03 |
|   2 |   UNION-ALL               |          |       |       |            |          |
|* 3 |     FILTER                 |          |       |       |            |          |
|   4 |     HASH GROUP BY         |          |    10 |   160 |    48 (11)| 00:00:01 |
|* 5 |       HASH JOIN OUTER      |          | 12890 |   201K|    44   (3)| 00:00:01 |
|   6 |       INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 |       2   (0)| 00:00:01 |
|   7 |       TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 8 |     FILTER                 |          |       |       |            |          |
|   9 |     HASH GROUP BY         |          |    50 |   800 |    48 (15)| 00:00:01 |
| 10 |       NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 11 |        TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 12 |       INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
|* 13 |    FILTER                 |          |       |       |            |          |
| 14 |      HASH GROUP BY         |          |    50 |   800 |    48 (15)| 00:00:01 |
| 15 |       NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 16 |        TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 17 |       INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
|* 18 |    FILTER                 |          |       |       |            |          |
| 19 |      HASH GROUP BY         |          |    50 |   800 |    48 (15)| 00:00:01 |
| 20 |       NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 21 |        TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 22 |       INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
--------------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
          0 recursive calls
          0 db block gets
      39419 consistent gets
          0 physical reads
          0 redo size
      26289 bytes sent via SQL*Net to client
       1107 bytes received via SQL*Net from client
         68 SQL*Net roundtrips to/from client
          1 sorts (memory)
          0 sorts (disk)
       1000 rows processed
Elapsed: 00:00:01.50
-------------------------------------------------------------------------------------
| Id | Operation                 | Name     | Rows | Bytes | Cost (%CPU)| Time      |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT         |          |   160 | 2560 |    184 (77)| 00:00:03 |
|   1 | UNION-ALL                |          |       |       |            |          |
|* 2 |    FILTER                 |          |       |       |            |          |
|   3 |    HASH GROUP BY         |          |    10 |   160 |    46   (7)| 00:00:01 |
|* 4 |      HASH JOIN OUTER      |          | 12890 |   201K|    44   (3)| 00:00:01 |
|   5 |      INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 |       2   (0)| 00:00:01 |
|   6 |      TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 7 |    FILTER                 |          |       |       |            |          |
|   8 |    HASH GROUP BY         |          |    50 |   800 |    46 (11)| 00:00:01 |
|   9 |     NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 10 |       TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 11 |      INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
|* 12 |   FILTER                 |          |       |       |            |          |
| 13 |     HASH GROUP BY         |          |    50 |   800 |    46 (11)| 00:00:01 |
| 14 |      NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 15 |       TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 16 |      INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
|* 17 |   FILTER                 |          |       |       |            |          |
| 18 |     HASH GROUP BY         |          |    50 |   800 |    46 (11)| 00:00:01 |
| 19 |      NESTED LOOPS         |          | 12890 |   201K|    44   (7)| 00:00:01 |
| 20 |       TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
|* 21 |      INDEX UNIQUE SCAN   | CUST2_PK |     1 |     5 |     0   (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
          0 recursive calls
          0 db block gets
      39419 consistent gets
          0 physical reads
          0 redo size
      24813 bytes sent via SQL*Net to client
       1107 bytes received via SQL*Net from client
         68 SQL*Net roundtrips to/from client
          0 sorts (memory)
          0 sorts (disk)
       1000 rows processed
Differences?

•   Elapsed time went from 1.51s to 1.50s
•   Memory sorts were reduced from 1 to 0
•   Query cost reduced from 191 to 184
•   Consistent gets stayed the same




                    I still need better response time
                    and less resource consumption.
                                 Now what?
Let’s give the human a try
I rewrite the query…

SQL> get cust_disc_rewrite.sql
1 select c.cust_no, sum(o.total_order_price)    tot_orders,
2         (case when sum(o.total_order_price)   = 0 then 0
3               when sum(o.total_order_price)   <= 100000 then .10
4               when sum(o.total_order_price)   <= 500000 then .15
5               when sum(o.total_order_price)   > 500000 then .20
6          else 0 end) as disc_rate
7    from customer2 c, ord2 o
8   where c.cust_no = o.cust_no(+)
9* group by c.cust_no
…and make a huge difference!
Elapsed: 00:00:00.29

-----------------------------------------------------------------------------------
| Id | Operation               | Name     | Rows | Bytes | Cost (%CPU)| Time      |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          | 1000 | 16000 |     46   (7)| 00:00:01 |
|   1 | HASH GROUP BY          |          | 1000 | 16000 |     46   (7)| 00:00:01 |
|* 2 |    HASH JOIN OUTER      |          | 12890 |   201K|    44   (3)| 00:00:01 |
|   3 |    INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 |       2   (0)| 00:00:01 |
|   4 |    TABLE ACCESS FULL   | ORD2     | 12890 |   138K|    41   (0)| 00:00:01 |
-----------------------------------------------------------------------------------
The query uses 191 vs. 39,419 LIOs
             and runs in .29 seconds!
Statistics
----------------------------------------------------------
          0 recursive calls
          0 db block gets
        191 consistent gets
          0 physical reads
          0 redo size
      26279 bytes sent via SQL*Net to client
       1107 bytes received via SQL*Net from client
         68 SQL*Net roundtrips to/from client
          0 sorts (memory)
          0 sorts (disk)
       1000 rows processed
The moral of the story
Something else to keep in mind…
Tools on the market today do not use a
   business-task focused approach
    to solve a performance problem
The Advisors and Enterprise Manager
mainly monitor system-wide metrics
What do you do if your
user’s performance problem
  isn’t representative of
 the system-wide issues?
That’s exactly what
     Method R
    is all about
1. Determine the business task that is
   performing sub-optimally that you want to fix
   next.
2. Collect detailed statistics about how this
   task spends its time while it is performing
   poorly.
3. Execute repairs to reduce the task’s
   response time and/or resources consumed,
   or prove that it is already as efficient as it
   can affordably be made.
4. If problems still exist, then go to step 1.
There is a belief that there is a downside to a
     business task-focused approach.
Many believe it’s too difficult to get access to
     the information or people needed.
It seems easier to focus on what the “system”
 has to tell us in order to find and fix problems.
Remember the monkeys?
Enter the astronaut.
The costs of following the wrong advise
         can be substantial.
If you are working on the wrong thing,
     the real problem remains and
   the business continues to suffer.
Conclusion
Don’t let the advisors –
    or any ‘automatic’ feature
become the dictator of your career.
Tools are there to facilitate our knowledge,
              not replace it.
Use the tools wisely but not
as a substitute for your own
      lack of knowledge.
The bottom line
The key is about a thirst for knowledge…
      not just the knowledge itself.
It’s about how we strive to learn,
  understand, and know how and why
things work that makes the difference.
It is the fulfillment of the desire to know
that leads us to the knowledge we need
  to evolve from monkey to astronaut
  and to be able to solve the problems
           that seem unsolvable.
It takes effort but the result is
   that you become a respected,
invaluable resource with the skills
   and confidence to impact your
     business in a positive way.
Thank You!

Mais conteúdo relacionado

Destaque

Mink by Rebecca
Mink by RebeccaMink by Rebecca
Mink by Rebeccavebrya
 
Reaching net-generation learners with social technologies
Reaching net-generation learners with social technologiesReaching net-generation learners with social technologies
Reaching net-generation learners with social technologiesguestba21f9
 
Garden 5 9 08 Presentation7
Garden 5 9 08 Presentation7Garden 5 9 08 Presentation7
Garden 5 9 08 Presentation7themir
 
Power Point
Power PointPower Point
Power PointMJH123
 
媽祖2012五騎有保佑
媽祖2012五騎有保佑媽祖2012五騎有保佑
媽祖2012五騎有保佑olivertw
 
Leadership.Mena
Leadership.MenaLeadership.Mena
Leadership.Menaagek2005
 
Muskrats by Morgan
Muskrats by MorganMuskrats by Morgan
Muskrats by Morganvebrya
 
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy www.erickson.it
 
Using Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twUsing Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twKazuho Oku
 
A Tour of Google Earth
A Tour of Google EarthA Tour of Google Earth
A Tour of Google EarthHeather Dowd
 
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...Hendrik Drachsler
 
Perspectivas de la comunicación 2016
Perspectivas de la comunicación 2016Perspectivas de la comunicación 2016
Perspectivas de la comunicación 2016Davinia Suárez
 

Destaque (17)

Mink by Rebecca
Mink by RebeccaMink by Rebecca
Mink by Rebecca
 
Reaching net-generation learners with social technologies
Reaching net-generation learners with social technologiesReaching net-generation learners with social technologies
Reaching net-generation learners with social technologies
 
Zendframework Parte2
Zendframework    Parte2Zendframework    Parte2
Zendframework Parte2
 
Garden 5 9 08 Presentation7
Garden 5 9 08 Presentation7Garden 5 9 08 Presentation7
Garden 5 9 08 Presentation7
 
Power Point
Power PointPower Point
Power Point
 
媽祖2012五騎有保佑
媽祖2012五騎有保佑媽祖2012五騎有保佑
媽祖2012五騎有保佑
 
Leadership.Mena
Leadership.MenaLeadership.Mena
Leadership.Mena
 
Muskrats by Morgan
Muskrats by MorganMuskrats by Morgan
Muskrats by Morgan
 
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy
The Italian Model Of The Inclusion. Dario Ianes. Edizioni Erickson. Italy
 
Using Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twUsing Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.tw
 
βρασμός
βρασμόςβρασμός
βρασμός
 
A Tour of Google Earth
A Tour of Google EarthA Tour of Google Earth
A Tour of Google Earth
 
Analisi
AnalisiAnalisi
Analisi
 
Oporto
OportoOporto
Oporto
 
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...
ReMashed – Recommendation Approaches for Mash-Up Personal Learning Environmen...
 
Perspectivas de la comunicación 2016
Perspectivas de la comunicación 2016Perspectivas de la comunicación 2016
Perspectivas de la comunicación 2016
 
Net Defender
Net DefenderNet Defender
Net Defender
 

Semelhante a Are you a monkey or an astronaut?

Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuningGuy Harrison
 
Find it. Fix it. Real-World SQL Tuning Cases with Karen Morton
Find it. Fix it. Real-World SQL Tuning Cases with Karen MortonFind it. Fix it. Real-World SQL Tuning Cases with Karen Morton
Find it. Fix it. Real-World SQL Tuning Cases with Karen MortonEmbarcadero Technologies
 
Oracle Diagnostics : Joins - 1
Oracle Diagnostics : Joins - 1Oracle Diagnostics : Joins - 1
Oracle Diagnostics : Joins - 1Hemant K Chitale
 
The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...Lucas Jellema
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersRiyaj Shamsudeen
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performanceGuy Harrison
 
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...The Art of Intelligence – A Practical Introduction Machine Learning for Orac...
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...Lucas Jellema
 
12 things Oracle DBAs must know about SQL
12 things Oracle DBAs must know about SQL12 things Oracle DBAs must know about SQL
12 things Oracle DBAs must know about SQLSolarWinds
 
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 In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionTanel Poder
 
Database and application performance vivek sharma
Database and application performance vivek sharmaDatabase and application performance vivek sharma
Database and application performance vivek sharmaaioughydchapter
 
RIPE Atlas Tutorial
RIPE Atlas TutorialRIPE Atlas Tutorial
RIPE Atlas TutorialRIPE NCC
 
Indexing Strategies for Oracle Databases - Beyond the Create Index Statement
Indexing Strategies for Oracle Databases - Beyond the Create Index StatementIndexing Strategies for Oracle Databases - Beyond the Create Index Statement
Indexing Strategies for Oracle Databases - Beyond the Create Index StatementSean Scott
 
Think simple and spare yourself a facepalm - EN
Think simple and spare yourself a facepalm - ENThink simple and spare yourself a facepalm - EN
Think simple and spare yourself a facepalm - ENMichal Simonik
 
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMB
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMBADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMB
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMBLudovico Caldara
 
ClickHouse 2018. How to stop waiting for your queries to complete and start ...
ClickHouse 2018.  How to stop waiting for your queries to complete and start ...ClickHouse 2018.  How to stop waiting for your queries to complete and start ...
ClickHouse 2018. How to stop waiting for your queries to complete and start ...Altinity Ltd
 
Get Competitive with Driverless AI
Get Competitive with Driverless AIGet Competitive with Driverless AI
Get Competitive with Driverless AISri Ambati
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTraceahl0003
 

Semelhante a Are you a monkey or an astronaut? (20)

Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
SQLd360
SQLd360SQLd360
SQLd360
 
Find it. Fix it. Real-World SQL Tuning Cases with Karen Morton
Find it. Fix it. Real-World SQL Tuning Cases with Karen MortonFind it. Fix it. Real-World SQL Tuning Cases with Karen Morton
Find it. Fix it. Real-World SQL Tuning Cases with Karen Morton
 
Oracle Diagnostics : Joins - 1
Oracle Diagnostics : Joins - 1Oracle Diagnostics : Joins - 1
Oracle Diagnostics : Joins - 1
 
The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineers
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performance
 
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...The Art of Intelligence – A Practical Introduction Machine Learning for Orac...
The Art of Intelligence – A Practical Introduction Machine Learning for Orac...
 
12 things Oracle DBAs must know about SQL
12 things Oracle DBAs must know about SQL12 things Oracle DBAs must know about SQL
12 things Oracle DBAs must know about SQL
 
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 In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in Action
 
Database and application performance vivek sharma
Database and application performance vivek sharmaDatabase and application performance vivek sharma
Database and application performance vivek sharma
 
RIPE Atlas Tutorial
RIPE Atlas TutorialRIPE Atlas Tutorial
RIPE Atlas Tutorial
 
Indexing Strategies for Oracle Databases - Beyond the Create Index Statement
Indexing Strategies for Oracle Databases - Beyond the Create Index StatementIndexing Strategies for Oracle Databases - Beyond the Create Index Statement
Indexing Strategies for Oracle Databases - Beyond the Create Index Statement
 
Quick Wins
Quick WinsQuick Wins
Quick Wins
 
Think simple and spare yourself a facepalm - EN
Think simple and spare yourself a facepalm - ENThink simple and spare yourself a facepalm - EN
Think simple and spare yourself a facepalm - EN
 
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMB
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMBADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMB
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMB
 
ClickHouse 2018. How to stop waiting for your queries to complete and start ...
ClickHouse 2018.  How to stop waiting for your queries to complete and start ...ClickHouse 2018.  How to stop waiting for your queries to complete and start ...
ClickHouse 2018. How to stop waiting for your queries to complete and start ...
 
Get Competitive with Driverless AI
Get Competitive with Driverless AIGet Competitive with Driverless AI
Get Competitive with Driverless AI
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTrace
 

Mais de Karen Morton

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL PerformanceKaren Morton
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceKaren Morton
 
The Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different PerspectiveThe Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different PerspectiveKaren Morton
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceKaren Morton
 
Performance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, HowPerformance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, HowKaren Morton
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimizationKaren Morton
 

Mais de Karen Morton (6)

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL Performance
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 
The Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different PerspectiveThe Oracle Advisors from a Different Perspective
The Oracle Advisors from a Different Perspective
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 
Performance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, HowPerformance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, How
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimization
 

Último

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Último (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Are you a monkey or an astronaut?

  • 1. Are you a monkey or an astronaut? The Oracle Advisors from a different perspective. Karen Morton karen.morton@method-r.com
  • 2. Your speaker… • Karen Morton – Educator, DBA, developer, consultant, researcher, author, speaker, … – Director – Software, education, consulting Committed to genuinely satisfying software performance • Come see us… – method-r.com – karenmorton.blogspot.com – An Oracle user group near you
  • 3. Agenda • Introduction • The “Self-Managing” Database • Before and After • What do we really want? • When the Advisors mislead • It takes human intelligence • Conclusion • Q&A
  • 4. It is impossible to underrate human intelligence – beginning with one’s own. Henry Brooks Adams
  • 9. Are you a monkey?
  • 10. Or, are you an astronaut?
  • 13. Database performance optimization is a “complex, time consuming task and requires expensive specialist consulting skills” to perform
  • 14. Performance diagnosis and tuning is mostly about following a logical, methodical approach. Fortunately computers are pretty good at that! Graham Wood & Kyle Hailey
  • 15. What role will we choose and what is the risk?
  • 16.
  • 17. DBA x The system is slow! ! Please fix it now x
  • 18. How would you diagnose the problem?
  • 19. 1) Check server to determine if adequate resources are available
  • 20. 2) Check database and notice many sessions are waiting on “latch free” waits
  • 21. 3) Drilling down into latches shows most are on “library cache” and “shared pool” latches
  • 22. 4) From knowledge, experience and reference books, you know these latches are associated with hard parsing issues
  • 23. 5) Double-check the hypothesis that hard parsing is the problem by looking at the rate at which “parse time elapsed” and “parse time cpu” are increasing
  • 24. 6) Now determine if one or more sessions are responsible for the majority of the hard parses or check shared pool for existence of many similar statements with the same SQL plan
  • 25. 7) By looking at the shared pool, you find there are a small number of plans each of which has many different SQL texts associated with it (they differ only by a literal)
  • 26. 8) Now the problem is identified and you can move on to fixing it
  • 27. With ADDM, how would the problem have been diagnosed?
  • 28. ADDM says… SQL statements were not shared due to usage of literals. This resulted in additional hard parses which were consuming significant database time.
  • 29. ADDM recommends… ACTION: Investigate application logic for possible use of bind variables instead of literals. Alternatively, you may set the parameter CURSOR_SHARING to FORCE.
  • 30. …because… RATIONALE: SQL statements with PLAN_HASH_VALUE 3106087033 were found to be using literals. Look in V$SQL for examples of such SQL statements.
  • 31. Without ADDM With ADDM • Multiple investigative steps must be • Consult the latest ADDM report completed • No mention of latching at all in the • Must have knowledge of what latch report free waits indicate • Exact SQL identified with • Must locate the problem SQL PLAN_HASH_VALUE • Requires executing queries against • No additional overhead needed as database that add overhead to the report is based on previously system collected snapshot data Given this example, which method of diagnosis would you prefer?
  • 32. ADDM did a great job!
  • 33. Who wouldn’t want to spend less time getting to the root cause of a problem?
  • 35. Could you have diagnosed the problem without ADDM?
  • 36. If you could have diagnosed the problem, would using ADDM have been quicker (and therefore, better)?
  • 37. What would you have done if you fixed the problem as described by ADDM, but the user says “it’s still slow”?
  • 38. Instead of using the human brain, humans have created another brain to do the job. There is nothing around us that is not built to cater to the needs of the human race and to ease off the duties of what the human brain is supposed to do; for instance, thinking. Is laziness going to be the death of the human race? Kurt Vonnegut
  • 39. What do we really want?
  • 41. A checklist, a “how-to”, a tool or some secret parameter? alter system set fast = true;
  • 42. What most people really want is knowledge and experience …that allows us to confidently approach a problem and solve it efficiently
  • 43. We want training that teaches us how and why things work as they do …and teaches us how to “know” what to do and how to do it when problems arise
  • 44. The part of intuition that involves pattern matching and recognition of familiar and typical cases can be trained. If you want people to size up situations quickly and accurately, you need to expand their experience base. One way is to arrange for a person to receive more difficult cases. Gary Klein …or simply have them become an Oracle DBA or developer.
  • 46. What would you do if the problem isn’t resolved via the advisors?
  • 47. The advisors aren’t true artificial intelligence
  • 48. They can only pattern match, aggregate and assimilate answers based on programmed heuristics
  • 49. They can only suggest solutions within a realm of known (i.e. built-in) possibilities
  • 51. They can miss something or “get it wrong”
  • 52. It takes human intelligence
  • 53. SQL Tuning Advisor vs. Human
  • 55.
  • 56.
  • 57. So, how did the SQL Advisor do?
  • 58. Let’s compare using AUTOTRACE Elapsed: 00:00:01.51 -------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 160 | 2560 | 191 (78)| 00:00:03 | | 1 | SORT UNIQUE | | 160 | 2560 | 191 (78)| 00:00:03 | | 2 | UNION-ALL | | | | | | |* 3 | FILTER | | | | | | | 4 | HASH GROUP BY | | 10 | 160 | 48 (11)| 00:00:01 | |* 5 | HASH JOIN OUTER | | 12890 | 201K| 44 (3)| 00:00:01 | | 6 | INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 | 2 (0)| 00:00:01 | | 7 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 8 | FILTER | | | | | | | 9 | HASH GROUP BY | | 50 | 800 | 48 (15)| 00:00:01 | | 10 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 11 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 12 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | |* 13 | FILTER | | | | | | | 14 | HASH GROUP BY | | 50 | 800 | 48 (15)| 00:00:01 | | 15 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 16 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 17 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | |* 18 | FILTER | | | | | | | 19 | HASH GROUP BY | | 50 | 800 | 48 (15)| 00:00:01 | | 20 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 21 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 22 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | --------------------------------------------------------------------------------------
  • 59. Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 39419 consistent gets 0 physical reads 0 redo size 26289 bytes sent via SQL*Net to client 1107 bytes received via SQL*Net from client 68 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 1000 rows processed
  • 60. Elapsed: 00:00:01.50 ------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 160 | 2560 | 184 (77)| 00:00:03 | | 1 | UNION-ALL | | | | | | |* 2 | FILTER | | | | | | | 3 | HASH GROUP BY | | 10 | 160 | 46 (7)| 00:00:01 | |* 4 | HASH JOIN OUTER | | 12890 | 201K| 44 (3)| 00:00:01 | | 5 | INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 | 2 (0)| 00:00:01 | | 6 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 7 | FILTER | | | | | | | 8 | HASH GROUP BY | | 50 | 800 | 46 (11)| 00:00:01 | | 9 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 10 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 11 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | |* 12 | FILTER | | | | | | | 13 | HASH GROUP BY | | 50 | 800 | 46 (11)| 00:00:01 | | 14 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 15 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 16 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | |* 17 | FILTER | | | | | | | 18 | HASH GROUP BY | | 50 | 800 | 46 (11)| 00:00:01 | | 19 | NESTED LOOPS | | 12890 | 201K| 44 (7)| 00:00:01 | | 20 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | |* 21 | INDEX UNIQUE SCAN | CUST2_PK | 1 | 5 | 0 (0)| 00:00:01 | -------------------------------------------------------------------------------------
  • 61. Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 39419 consistent gets 0 physical reads 0 redo size 24813 bytes sent via SQL*Net to client 1107 bytes received via SQL*Net from client 68 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1000 rows processed
  • 62. Differences? • Elapsed time went from 1.51s to 1.50s • Memory sorts were reduced from 1 to 0 • Query cost reduced from 191 to 184 • Consistent gets stayed the same I still need better response time and less resource consumption. Now what?
  • 63. Let’s give the human a try
  • 64. I rewrite the query… SQL> get cust_disc_rewrite.sql 1 select c.cust_no, sum(o.total_order_price) tot_orders, 2 (case when sum(o.total_order_price) = 0 then 0 3 when sum(o.total_order_price) <= 100000 then .10 4 when sum(o.total_order_price) <= 500000 then .15 5 when sum(o.total_order_price) > 500000 then .20 6 else 0 end) as disc_rate 7 from customer2 c, ord2 o 8 where c.cust_no = o.cust_no(+) 9* group by c.cust_no
  • 65. …and make a huge difference! Elapsed: 00:00:00.29 ----------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1000 | 16000 | 46 (7)| 00:00:01 | | 1 | HASH GROUP BY | | 1000 | 16000 | 46 (7)| 00:00:01 | |* 2 | HASH JOIN OUTER | | 12890 | 201K| 44 (3)| 00:00:01 | | 3 | INDEX FAST FULL SCAN| CUST2_PK | 1000 | 5000 | 2 (0)| 00:00:01 | | 4 | TABLE ACCESS FULL | ORD2 | 12890 | 138K| 41 (0)| 00:00:01 | -----------------------------------------------------------------------------------
  • 66. The query uses 191 vs. 39,419 LIOs and runs in .29 seconds! Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 191 consistent gets 0 physical reads 0 redo size 26279 bytes sent via SQL*Net to client 1107 bytes received via SQL*Net from client 68 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1000 rows processed
  • 67. The moral of the story
  • 68. Something else to keep in mind…
  • 69. Tools on the market today do not use a business-task focused approach to solve a performance problem
  • 70. The Advisors and Enterprise Manager mainly monitor system-wide metrics
  • 71. What do you do if your user’s performance problem isn’t representative of the system-wide issues?
  • 72. That’s exactly what Method R is all about
  • 73. 1. Determine the business task that is performing sub-optimally that you want to fix next.
  • 74. 2. Collect detailed statistics about how this task spends its time while it is performing poorly.
  • 75. 3. Execute repairs to reduce the task’s response time and/or resources consumed, or prove that it is already as efficient as it can affordably be made.
  • 76. 4. If problems still exist, then go to step 1.
  • 77. There is a belief that there is a downside to a business task-focused approach.
  • 78. Many believe it’s too difficult to get access to the information or people needed.
  • 79. It seems easier to focus on what the “system” has to tell us in order to find and fix problems.
  • 82. The costs of following the wrong advise can be substantial.
  • 83. If you are working on the wrong thing, the real problem remains and the business continues to suffer.
  • 85. Don’t let the advisors – or any ‘automatic’ feature become the dictator of your career.
  • 86. Tools are there to facilitate our knowledge, not replace it.
  • 87. Use the tools wisely but not as a substitute for your own lack of knowledge.
  • 89. The key is about a thirst for knowledge… not just the knowledge itself.
  • 90. It’s about how we strive to learn, understand, and know how and why things work that makes the difference.
  • 91. It is the fulfillment of the desire to know that leads us to the knowledge we need to evolve from monkey to astronaut and to be able to solve the problems that seem unsolvable.
  • 92. It takes effort but the result is that you become a respected, invaluable resource with the skills and confidence to impact your business in a positive way.
  • 93.
  • 94.