Panorama: Fix changed execution plans

You recognize a long running query caused by poor execution plan.

You also know that until yesterday this query worked fine but now execution plan has suddenly changed due to ???.

Filipe Martins named a solution here by transferring a good execution plan from AWR history into a SQL plan baseline.

This solution is available in Panorama now.
It allows you to quickly generate a SQL snippet for creation of  SQL plan baseline by simple button click.

Steps to fix this issue:

  1. Identify the problematic query, open SQL details page in Panorama for this statement.
    For example via menu “SGA/PGA details” / “SQL Area” / “Current”
  2. Hit button “Complete time line of SQL” at the bottom of the SQL details page
  3. Identify a day (or hour/minute) in history in the list with exactly one good execution plan.
    Column “Elapsed/Execution” may help you to rate the quality.
    Column “Plan hash value” allows you to differentiate different plans.
  4. Click the link in column “Start time” to open SQL detail page for this period
  5. Hit button “Generate SQL plan baseline” at the bottom of the SQL details page
  6. Execute the generated SQL snippet as appropriate user, e.g. SYS as SYSDBA

Now next execution of this statement will use the execution plan pinned by SQL plan baseline.

SQL details page will show you now the existence and some parameters of SQL plan baseline.

Remember please, that this joyful solution may be only temporary because if you modify the SQL statement next time it will lose the link to baseline.
So a better permanent solution would be to fix the execution plan by appropriate analyze-info, using optimizer hints in SQL etc. .

 

Author: Peter Ramm

Within more than 20 years in software development with Oracle databases there are many experiences and best practices. Many of them bundled in my app "Panorama". See http://rammpeter.github.io

Leave a comment