Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How Oracle Optimizer chooses best plans?

Posted on 2014-03-04
2
Medium Priority
?
375 Views
Last Modified: 2014-03-05
Hi,

I have following question related to oracle optimizer.

When a query is given to optimizer,
1. How it creates different plans without executing it.?
2. I believe only if the results are less than certain % of rows it uses index, for identifying this,
    it has to execute query right?

Please help me in understanding the above by giving some relevant examples or links.
0
Comment
Question by:sakthikumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 39905505
1 - that's a huge question.
   If you really want to understand it I recommend reading Jonathan Lewis' book "Cost-Based Oracle Fundamentals"

As a quick list of some of the large factors-
the expected cardinalties of joins and filtering conditions
the availability of indexes, existence or absence of hints
the existence or absence of sql profiles
various init parameters
available temp space, memory and cpu
Parallel options on tables, indexes, partitions and subpartitions, etc.
ordering criteria
uniqueness



2 - no that is not correct.  Number of rows has almost nothing to do with it except incidentally.  Indexes are chosen based on the number anticipated blocks that will be read.  Of course, if you have few rows then the blocks will likely be smaller and if many rows the number of blocks will likely be larger; but the actual row count isn't particularly important.  It's the blocks.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 39905699
yeah, huge question
1. basically it comes down to statistics
most of the items sdstuber indicates are gathered in statistics
based on those statistics the optimizer doesn't have to execute anything to build an execution plan

2. again ... statistics

the oracle performance tuning guide contains a few chapters, here is one
http://docs.oracle.com/cd/E11882_01/server.112/e10822/tdppt_sqltune.htm#TDPPT160
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question