RE: Why my query plan changed ?

  • From: "Elliott, Patrick" <patrick.elliott@xxxxxxxxxxxxx>
  • To: "oracledba.williams@xxxxxxxxx" <oracledba.williams@xxxxxxxxx>, "ajayoraclel@xxxxxxxxx" <ajayoraclel@xxxxxxxxx>
  • Date: Wed, 17 Sep 2008 11:01:18 -0500

What you are seeing is the feature called bind variable peeking.  The first 
time a query hits the shared pool, the optimizer check the value of the bind 
variables and then uses these variables to build the query plan.  If the query 
gets aged out of the shared pool, then this process is repeated with possibly 
new bind variable values.  As a result the query plan changes.  The query plan 
changes less with cursor_sharing=force than with cursor_sharing=exact since 
cursor_sharing=exact does not replace literals with bind variables.


Pat



________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Dennis Williams
Sent: Wednesday, September 17, 2008 8:48 AM
To: ajayoraclel@xxxxxxxxx
Cc: jaromir@xxxxxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: Re: Why my query plan changed ?

Ajay,

I haven't worked with CURSOR_SHARING, so I cannot give you an answer based on 
experience, but just speculation. Perhaps someone else on the list has better 
advice.
    Since the goal of CURSOR_SHARING=FORCE is to avoid continual parsing and 
optimizing, I would assume that when you submit a SQL statement to Oracle, it 
is first converted to an equivalent statement with bind variables, and then 
Oracle will search for an existing equivalent SQL statement, and if it finds 
one, will use that execution plan. Therefore in answer to your question, I 
would assume that CURSOR_SHARING=FORCE would have the same side effect, that 
whatever execution plan is generated, all subsequent queries will share it.

Dennis Williams

[CONFIDENTIALITY AND PRIVACY NOTICE]

Information transmitted by this email is proprietary to Medtronic and is 
intended for use only by the individual or entity to which it is addressed, and 
may contain information that is private, privileged, confidential or exempt 
from disclosure under applicable law. If you are not the intended recipient or 
it appears that this mail has been forwarded to you without proper authority, 
you are notified that any use or dissemination of this information in any 
manner is strictly prohibited. In such cases, please delete this mail from your 
records.

To view this notice in other languages you can either select the following link 
or manually copy and paste the link into the address bar of a web browser: 
http://emaildisclaimer.medtronic.com

Other related posts: