My big challenge this week was an 11g database that wouldn't behave. I'm sure you've been there.. Getting frustrated by a database that doesn't seen to perform right.
I can tell you that challenge has gotten even bigger in 11g.. A new feature was added called "cardinality feedback". The idea is simple. Oracle comes up with a plan, including cardinality for each step, and then executes the plan. If, after executing the plan, the optimizer believes that the Actual cardinality is out of line with the estimated cardinality, the optimizer will pick a new plan.
Sounds like a great feature right ? But what if you have issues with histograms, and your actual cardinality is lopsided. Oracle may chose a plan, run against the lobsided data, and decided the plan is no good. Oracle morphs the plan for you.. No charge, no control. It get's frrustrating.
The only quick fix I've found is the COE_PROFILE script that is part of the SQLT tuning kit available from MOS.
There is quick way to test this behavior (if you think it's occuring), use this undocumented parameter
-- Turn on cardinality feedback
alter session set "_optimizer_use_feedback" = true;
-- Turn off (disable) cardinality feedback
alter session set "_optimizer_use_feedback" = false;
I can tell you that challenge has gotten even bigger in 11g.. A new feature was added called "cardinality feedback". The idea is simple. Oracle comes up with a plan, including cardinality for each step, and then executes the plan. If, after executing the plan, the optimizer believes that the Actual cardinality is out of line with the estimated cardinality, the optimizer will pick a new plan.
Sounds like a great feature right ? But what if you have issues with histograms, and your actual cardinality is lopsided. Oracle may chose a plan, run against the lobsided data, and decided the plan is no good. Oracle morphs the plan for you.. No charge, no control. It get's frrustrating.
The only quick fix I've found is the COE_PROFILE script that is part of the SQLT tuning kit available from MOS.
There is quick way to test this behavior (if you think it's occuring), use this undocumented parameter
-- Turn on cardinality feedback
alter session set "_optimizer_use_feedback" = true;
-- Turn off (disable) cardinality feedback
alter session set "_optimizer_use_feedback" = false;