Friday, 28 February 2014

SQL plan changing automatically

Hi All,

I was faced with a situation in which one of our dw reports plan changed on the last day and it was running slow. Report plans can change as data increases and good running sql can go bad. There are ways to handle this.

1) Creating data profiles by DBA is one of the solution
2) Using hints in the query is a quick fix


Things learned
  1. If you use in to join a table in where cluase it will go for nested loop and this might slow your query down
  2. If you see the row number out of sync beware this might indicate that there is an issue with your statisitics
  1. Indexes do not need to be analysed in Oracle 11g . In Oracle 10 it was compute statistics a statement that was always there after you build indexes
  1. Not using Quotes for varchar column will cause it not to use indexes which can have a major impact on the plan including non use of star transformation
  2. Outer joins takes more time so avoid outer joins

Reading AWR Report


Reading Automatic Workload Report

A well formated AWR report can be got from ITG logon if your office has configured this. Or it can be got from SQL developer. Though the sql developer one is not formated it should be readable.

 

 



The Active Session History (ASH) reports enable you to analyze transient performance problems with the database that are short-lived and do not appear in the ADDM analysis.


The Automatic Workload Repository (AWR) Compare Periods report enables you to compare database performance between two periods of time, and resolve performance degradation that may happen from one time period to another.

Few very good Articles on active session history , V$session in oracle. The links are in order in which they are supposed to be read





http://www.oracle.com/technetwork/issue-archive/2013/13-jan/o13dba-1871177.html


Steps for reading AWR Report Follow screenshots in order