Quantcast
Viewing all articles
Browse latest Browse all 1814

Blog Post: Oracle Hints/Outlines

Hi, Just a quick blog while going down the stats path J …get it? Stats path…not Stats Pack…he he he… Anyway, Oracle10 turned the dictionary SQL over to the cost based optimizer. Did you know there is still a ‘rule’ hint? Yes! I believe this undocumented hint still exists (even in Oracle11r2…I have not reviewed dumps/traces from Oracle12 yet) because not all the Oracle dictionary SQL runs well in the CBO. The Oracle kernel developers just put the rule hint in and move along…such is life… There is a way to get an outline for even the rule-based SQL! This will fix any SQL you have left still using the rule based optimizer…maybe I blogged on this last summer…let me take a look. The CBO trace also gives these outlines (next paragraph) but this outline is pretty easy to get by adding the syntax ‘explain plan for’ to your code, run your code. SQL*Plus comes back with ‘Explained’. Now, the plan table is populated…run this code: Select * from table( dbms_xplan.display(FORMAT=>’OUTLINE’)) And you get this: Notice the Outline Data already has the /*+ and */. You copy/paste this into your SQL and you will get the same explain plan each time. There are hints to be learned here…like the DB_VERSION and the OPTIMIXER_FEATURES_ENABLE…turns the optimizer back to a prior version for JUST this one SQL. DBA’s sometimes turn these on for the entire system…turning ALL SQL back to a prior version. I know its more work to fix just what’s wrong but please do so so the rest of the SQL can take advantage of newer features. The SEL$1 are query blocks. Perhaps I should blog about these some…but I did cover them well in the January Article on the CBO trace. In March, I’m going to write about the SQL Plan Management (SPM)…a replacement for these outlines. The main difference is SPM is not controlled by hints but by saved explain plans. Oracle also monitors these for better executing explain plans… Dan Hotka Oracle ACE Director Instructor/Author/CEO

Viewing all articles
Browse latest Browse all 1814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>