What is the number of cost? [message #271280] |
Mon, 01 October 2007 02:28 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
trantuananh24hg
Messages: 744 Registered: January 2007 Location: Ha Noi, Viet Nam
|
Senior Member |
|
|
Dear!
Following the Oracle document, the cost means to..
Quote: |
The cost represents units of work or resource used. The CBO uses disk I/O, CPU usage, and memory usage as units of work. So, the cost used by the CBO represents an estimate of the number of disk I/Os and the amount of CPU and memory used in performing an operation. The operation can be scanning a table, accessing rows from a table by using an index, joining two tables together, or sorting a row set. The cost of a query plan is the number of work units that are expected to be incurred when the query is executed and its result produced.
|
And, please view my explain plan:
SQL> set autotrace traceonly explain
SQL> SELECT hdld.ma_kh, tbld.ma_tb, TRIM (tbld.ten_tb) ten_tb,
2 tbld.diachi diachitb, tbld.loaitb_id, ltb.dichvuvt_id, 1 sys_pageid,
3 100 sys_rec_per_page
4 FROM ccs_qbh1.thuebao_lds tbld,
5 ccs_qbh1.hopdong_lds hdld,
6 ccs_qbh1.loaihinh_tbs ltb
7 WHERE tbld.ma_hd = hdld.ma_hd
8 AND ltb.loaitb_id = tbld.loaitb_id
9 AND ROWNUM < 101
10 AND hdld.so_gt = '3'
11 /
Execution Plan
----------------------------------------------------------
Plan hash value: 4048859822
--------------------------------------------------------------------------------
---------------
| Id | Operation | Name | Rows | Bytes | Cost (%C
PU)| Time |
--------------------------------------------------------------------------------
---------------
| 0 | SELECT STATEMENT | | 1 | 154 | 6
(0)| 00:00:01 |
|* 1 | COUNT STOPKEY | | | |
| |
| 2 | NESTED LOOPS | | 1 | 154 | 6
(0)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 | 148 | 5
(0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| HOPDONG_LDS | 1 | 33 | 3
(0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | HDLD_CMT | 1 | | 1
(0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID| THUEBAO_LDS | 1 | 115 | 2
(0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | TBLD_MAHD | 1 | | 1
(0)| 00:00:01 |
| 8 | TABLE ACCESS BY INDEX ROWID | LOAIHINH_TBS | 1 | 6 | 1
(0)| 00:00:01 |
|* 9 | INDEX UNIQUE SCAN | LHTB_PK | 1 | | 0
(0)| 00:00:01 |
--------------------------------------------------------------------------------
---------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(ROWNUM<101)
5 - access("HDLD"."SO_GT"='3')
7 - access("TBLD"."MA_HD"="HDLD"."MA_HD")
9 - access("LTB"."LOAITB_ID"="TBLD"."LOAITB_ID")
It's my questions: What does the number of cost represent? Why is it the number? Where is the number? I do not really understand.
Would you like to explain or navigate to the related document which can be further clean explanation?
Thank you very much!
[Updated on: Mon, 01 October 2007 02:32] Report message to a moderator
|
|
|
Re: What is the number of cost? [message #271284 is a reply to message #271280] |
Mon, 01 October 2007 02:40 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68675 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
It is nothing (for you) just internal optimizer number that allows you to compare 2 plans.
It "represents units of work or resource used".
Quote: | Would you like to [...] navigate to the related document
|
Which document? you don't tell us nor give a link.
Regards
Michel
[Updated on: Mon, 01 October 2007 02:40] Report message to a moderator
|
|
|
Re: What is the number of cost? [message #271287 is a reply to message #271280] |
Mon, 01 October 2007 02:47 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
trantuananh24hg
Messages: 744 Registered: January 2007 Location: Ha Noi, Viet Nam
|
Senior Member |
|
|
Thank you Michael for your reply!
My English is bad, and it's same to my Oracle knowledge.
I mean that "I did not understand the number of cost" and said I that some one who could explain the number or give me any link related it.
Give up my mistake, please!
|
|
|
|
|
|