?
Solved

How Oracle Optimizer chooses best plans?

Posted on 2014-03-04
2
Medium Priority
?
373 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

752 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