Re: cost of nested loop join
- From: "jernigam@xxxxxxxxxxx" <jernigam@xxxxxxxxxxx>
- Date: 22 Jun 2006 06:26:03 -0700
I found the answer in Jonathan Lewis's CBO book. Oracle 9i round ups
the autotrace output. So I guess the actual calculation may have been
10+(61*1.5)
jernigam@xxxxxxxxxxx wrote:
I am trying to determine how the CBO came up with the cost of a nested
loop join.
Here is the query.
select
invd.invoice_id, invd.seq, invd.effective_date
from invoice inv, invoice_d invd
where invd.invoice_id = inv.invoice_id
and inv.Issued_Date between trunc(sysdate, 'MM') and trunc(sysdate)
Here is my explain plan
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=102 Card=327
Bytes=9156)
1 0 FILTER
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'INVOICE_D' (Cost=2
Card=5 Bytes=75)
3 2 NESTED LOOPS (Cost=102 Card=327 Bytes=9156)
4 3 TABLE ACCESS (BY INDEX ROWID) OF 'INVOICE' (Cost=10
Card=61 Bytes=793)
5 4 INDEX (RANGE SCAN) OF 'INVOICE_ISSUED' (NON-UNIQUE)
(Cost=3 Card=61)
6 3 INDEX (RANGE SCAN) OF 'INVOICE_D_PK' (UNIQUE) (Cost=2
Card=5)
My understanding is that the cost should be equal to cost of outer
table + ( cardinality of outer table + cost of inner table).
In this case I think that would be 10+(61*2)=132
Instead it equals 102. Is there something I am missing here?
.
- References:
- cost of nested loop join
- From: jernigam@xxxxxxxxxxx
- cost of nested loop join
- Prev by Date: Re: Problem in Enterprise Manager
- Next by Date: Re: Prompting multiples times in PL/SQL??
- Previous by thread: Re: cost of nested loop join
- Next by thread: large delete
- Index(es):
Loading