Review my blogs. A while back I described how Oracle11 (Oracle11.2) does this cardinality feedback. The optimizer notices that after the first execution of a SQL that the actual row counts are significantly different and maybe a different explain plan could be used…it marks it for re-hard parsing and upon the 2 nd execution, it re-hard parses using the actual row counts. IF you were to run an explain plan using the DBMS_XPLAN package, there would be a note at the bottom saying ‘cardinality feedback used’… I’ve long been an advocate of getting the actual row counts when trying to tune a problem SQL. The cardinality column of the explain plan is useless…it obviously wasn’t accurate enough for the CBO…and to you need the actual row counts to do accurate SQL tuning. See another blog or use my SQL Tuner tool for ACTUAL rowcounts with explain plans…the 10046 trace shows actual row counts too. Oracle11r2 implemented this cardinality feedback. I thought this was a really good idea until I recently received some feedback from a production user that when they notice this, the SQL actually runs more poorly. There are a couple of ways to turn off cardinality feedback: Add this hint to the problem SQL (my preference): SELECT /*+ opt_param('_OPTIMIZER_USE_FEEDBACK' 'FALSE') */ Or…set the init.ora setting: optimizer_features_enable < 11.2.0.1 Thank you Trent. Dan Hotka Oracle ACE Director Author/Instructor/CEO
↧