RE: Why my query plan changed ?

From: Elliott, Patrick <>
Date: Wed, 17 Sep 2008 11:01:18 -0500
Message-ID: <>

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.


From: [] On Behalf Of Dennis Williams Sent: Wednesday, September 17, 2008 8:48 AM To:
Cc:; Subject: Re: Why my query plan changed ?


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:

Received on Wed Sep 17 2008 - 11:01:18 CDT

Original text of this message