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 -> How hints affect the CBO?

How hints affect the CBO?

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Thu, 27 Jun 2002 14:45:35 +0400
Message-ID: <afeqck$q57$1@babylon.agtel.net>


Not sure if this is not a FAQ.

I was recently engaged in a discussions about hints and the way they affect CBO. I was insisting that CBO may ignore valid hints (those that are syntactically and semantically correct) if it finds a cheaper plan than those with access path suggested by the hint, and that hints only modify costs artificially so that hinted path looks better, but will not necessarily appear the best choice. A lot of people disagreed and told me that valid hint instructs CBO to throw other methods for affected step out of consideration (and I found something looking like proof for this in MetaLink note 10626.1, where it is said, that "To infuence the optimizer, users can specify "Hints" to _force_ the optimizer to consider a certain access strategy superior to others _irrespective_of_the_costs_".) and only evaluate cost for remaining plans, all of which include hinted access path. This behavior effectively means that valid hints are mandatory and CBO will in no event (bugs excluded) choose a different path if the environment did not change (i.e. indexes are still in place, statistics are current, etc.). That is, no matter how inneffective a query with FULL hint is, CBO will always do full scan even if index access yelds better plan, because it is explicitly instructed to do so and this is valid access path.

So, how does CBO work with respect to hints? Does it treat them as direct orders if they specify valid access path and does not consider alternatives, or does it just tweak costs so that the hinted path looks better than the others, but still can choose a different path? Anyone seen/can provide an example of CBO choosing path different from one suggested by a valid hint that does not exhibit a bug in CBO? I tried to come up with one tweaking optimizer_index_cost_adj to make indexes very expensive to CBO, but to no avail. Or valid hints are mandatory? Anyone can direct me to the correct place in documentation where this is explicitly stated (or explicitly stated otherwise)? Or maybe some Oracle insider can take a peek at the CBO code and tell for sure how hints affect it (don't think this will happen though)? ;)

Thanks in advance.

-- 
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.
Received on Thu Jun 27 2002 - 05:45:35 CDT

Original text of this message

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