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

No comments:

Post a Comment