Oracle Cost Base Optimizer - getting sucked in
The CBO is Truly Brilliant.
Oh Yes, it is.
Rant ?
me Rant ?
Never. I dont waste engergy that way.
Mind you, CBO is a worthy adversery when it comes to wasting energy. Especially after upgrades to 10g [link?].
Very Clever, the CBO.
The CBO will get it "mostly right in most of the cases" (famous quotation needed, but it is true). However those few cases where the CBO gets it wrong can really ruin your reputation.
I would always maintain that we paid Oracle to do the hard work for us, and I would not get sucked into doing arcane bespoke stuff with stats and hints and outlines and whatever to make a query do the bleeding obvious. Meanwhile, I spent hours tweaking all of the above, and reading near-scientific stuff trying to understand CBO just a bit better still. And now I finally got sucked in: I will join the ranks of those who have ranted presented on the CBO...
I must be careful here: Nobody ever got praised for pokeing fun at large vendors. The Real Application CBO is like those other Real Application Thingies: Oracle is Soooo Proud of it. No other database-vendor even comes close in ingenuity, in sheer intelligence, and in cunning engineering where query optimization is concerned.
So yes, I admit it, the CBO is Brilliant.
If it gets it right.
I did it again today:
A customer-meeting got sidetracked into "performance" and I spent 20 min explaining that when CBO made some seemingly inefficient decisions, it was not the CBO at fault. CBO tries as best it can. CBO will be using spfile-parameters, system-stats, object-stats, histograms, session-parameters, where-clauses, hints, outlines, and sql-plans and whatever other information it can glean from looking at the stars or tealeaves or whatever. So, if it is not the CBO at fault, it must be us, right ? We should have read the manual, the whitepapers, metalink, and followed the instructions available.
OK, real reason for this post: a plug for OUG Scotland.
I still need to write the abstract and the ppt, and wanted to aim it more towards efficient indexing, refer to Tapio and Richard Foote. Show CBO the obvious route (you can lead a clever horse to water) and it might just get it right... But my ppt will probably involve "how I fought the CBO".
Thomas already put up the title as a CBO related item...
These guys and many other good writers have basically said all there is to say already. And I am not qualified to tell you much on gathering stats or how to tweak parameters. Nor can I teach you about high-tech-hinting[link needed]. Others have done that before me, and did a much better job then I could hope to do.
I know my limitations.
I am going to take as Simple an approach as I can.