Mohamed Houri’s Oracle Notes

October 1, 2015

Oracle Optimizer and SPM plan interaction

Filed under: Oracle — hourim @ 5:25 pm

Continuing in the inspiration instilled into me by Dominic Brooks’ post on SQL Plan Management choices, I decided to picture the Oracle CBO behavior in presence of enabled and accepted SPM plan(s) baseline:

CBO-SPM interaction diagram

The right part of the picture, when triggered, demonstrates the parsing penalty you will have to pay before running your SQL query. Particularly when there are multiple accepted and enabled SPM plans the CBO has to try reproducing and costing all of them before making its final decision. The picture also shows that under all circumstances the CBO will start first by compiling its execution plan as if it is not constrained by any SPM plan. This clearly demonstrates that if your query is suffering from a hard parsing execution time (when the plan generation takes a lot of time) then SPM will not help you. This is where the mantra “When you can hint it then Baseline it” ceases to be accurate.


  1. […] Reminder of the baseline reproduction system […]

    Pingback by Did it really fix it 2: Plan flip, unprofileable, baseline OFE round 2 and “stability” | OraStory — November 16, 2015 @ 6:31 pm | Reply

  2. Maybe there’s something not quite right about this diagram (or I’m not reading it properly) because if the best cost plan doesn’t match the baseline then it will get inserted into the baseline anyway (if not fixed) for future evolution/evaluation regardless of whether round 1 or round 2 are successful

    Comment by Dom Brooks — November 17, 2015 @ 10:52 am | Reply

  3. Dom,

    You are absolutely right

    I will phrase the part of picture you are referring to for more clarity

    Whatever the compiled CBO plan is, it should go via one of the following paths:

    (1) it differs from an existing SPM plan : it will be inserted into the SPM baseline with ACCEPTED property set to NO (whether it will be used or not depends on the reproducibility of the SPM plan)
    (2) it equals an existing SPM plan : it will not be inserted into the SPM baseline because it’s already there and it will be used by the query

    The picture is, indeed, suggesting that the CBO plan will be inserted into the SPM baseline only if the SPM plan failed to be reproduced. Hopefully you are here to observe such kind of details. Thought that what I have in my mind was in accordance with your remark.

    I will update the picture as soon as possible

    Best regards

    Comment by hourim — November 19, 2015 @ 10:27 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at

Tony's Oracle Tips

Tony Hasler's light hearted approach to learning about Oracle

Richard Foote's Oracle Blog

Focusing Specifically On Oracle Indexes, Database Administration and Some Great Music

Hatem Mahmoud Oracle's blog

Just another Oracle blog : Database topics and techniques

Mohamed Houri’s Oracle Notes

Qui se conçoit bien s’énonce clairement

Oracle Diagnostician

Performance troubleshooting as exact science

Raheel's Blog

Things I have learnt as Oracle DBA

Coskan's Approach to Oracle

What I learned about Oracle

So Many Oracle Manuals, So Little Time

“Books to the ceiling, Books to the sky, My pile of books is a mile high. How I love them! How I need them! I'll have a long beard by the time I read them”—Lobel, Arnold. Whiskers and Rhymes. William Morrow & Co, 1988.

Carlos Sierra's Tools and Tips

Tools and Tips for Oracle Performance and SQL Tuning

Oracle Scratchpad

Just another Oracle weblog


Dominic Brooks on Oracle Performance, Tuning, Data Quality & Sensible Design ... (Now with added Sets Appeal)

%d bloggers like this: