Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: using bind variables makes the optimizer choose a bad plan

Re: using bind variables makes the optimizer choose a bad plan

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 8 Sep 2005 07:33:09 -0700
Message-ID: <1126189989.404474.323550@g47g2000cwa.googlegroups.com>


Hegyvari, you want to use bind variables everywhere you can because of the side effects on the performance of the library cache from failing to use them. This does mean you need to use hints sometimes to help the optimizer. Now since the code is being generated it would appear you do not have an option to change it away from using bind variables, which are not workint well in this case to using constants which are working well probably due the presence of histograms.

Have you looked at the outline feature. It should allow you to add a hint "dynamically" to the SQL statement every time it runs.

 Version 9+ offers bind variable peeking which may or may not help in the CBO recognizing the usefulness of the index. There are a few bugs with the feature which sometime prevent the desired performance benefit of the feature though the bugs do not result in any runtime errors stopping the SQL. You just do reparse the SQL or do not get the plan you expected.

HTH -- Mark D Powell -- Received on Thu Sep 08 2005 - 09:33:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US