Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: About CBO cost in oracle10g

Re: About CBO cost in oracle10g

From: eygle <eygle_at_itpub.net>
Date: 23 May 2004 19:31:34 -0700
Message-ID: <f9bc34d.0405231831.74df0e61@posting.google.com>


Thanks Jonathan.

It's standard emp/dept tables of 10g demo. And I have analyzed all of them.

The following is my step:

SYS AS SYSDBA on 24-MAY-04 >connect scott/tiger Connected.
SCOTT on 24-MAY-04 >exec dbms_stats.gather_schema_stats('SCOTT')

PL/SQL procedure successfully completed.

SCOTT on 24-MAY-04 >select table_name,num_rows from user_tables;

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
DEPT                                    4
EMP                                    14
BONUS                                   0
SALGRADE                                5

SCOTT on 24-MAY-04 >connect / as sysdba Connected.
SYS AS SYSDBA on 24-MAY-04 >shutdown immediate Database closed.
Database dismounted.
ORACLE instance shut down.
SYS AS SYSDBA on 24-MAY-04 >startup
ORACLE instance started.

Total System Global Area 314572800 bytes

Fixed Size                  1301704 bytes
Variable Size             274473784 bytes
Database Buffers           37748736 bytes
Redo Buffers                1048576 bytes
Database mounted.
Database opened.
SYS AS SYSDBA on 24-MAY-04 >connect scott/tiger Connected.
SCOTT on 24-MAY-04 >alter session set events '10053 trace name context forever,level 1';

Session altered.

SCOTT on 24-MAY-04 >explain plan for select ename,dname from emp ,dept where emp.deptno = dept.deptno;

Explained.

And every time I got the same result.
I'll try to post trace file here.

/opt/oracle/soft/eygle_ora_9040.trc
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options ORACLE_HOME = /opt/oracle/product/10.0.1 System name: SunOS

Node name:      billing-center.hurray.com.cn
Release:        5.8
Version:        Generic_108528-23
Machine:        sun4u

Instance name: eygle
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 9040, image: oracle_at_billing-center.hurray.com.cn (TNS V1-V3)

Plan Table




-
| Operation                      | Name               | Rows  | Bytes
| Cost  | Time      |  TQ  |IN-OUT| PQ Distrib |Pstart| Pstop
|

-
| SELECT STATEMENT               |                    |       |      
|     6 |           |      |      |           |       |
|
|  MERGE JOIN                    |                    |    14 |   308
|     6 |  00:00:01 |      |      |           |       |
|
|   TABLE ACCESS BY INDEX ROWID  | DEPT               |     4 |    52
|     2 |  00:00:01 |      |      |           |       |
|
|    INDEX FULL SCAN             | PK_DEPT            |     4 |      
|     1 |  00:00:01 |      |      |           |       |
|
|   SORT JOIN                    |                    |    14 |   126
|     4 |  00:00:01 |      |      |           |       |
|
|    TABLE ACCESS FULL           | EMP                |    14 |   126
|     3 |  00:00:01 |      |      |           |       |
|

-

And the cpu_cost and io_cost of plan_table is :

SCOTT on 24-MAY-04 >select
OPERATION,object_name,cost,CARDINALITY,CPU_COST,IO_COST from plan_table;

OPERATION                      OBJECT_NAM       COST CARDINALITY  
CPU_COST IO_COST
------------------------------ ---------- ---------- -----------
---------- ----------
SELECT STATEMENT                                   6          14   
1890571          5
MERGE JOIN                                         6          14   
1890571          5
TABLE ACCESS                   DEPT                2           4     
15563          2
INDEX                          PK_DEPT             1           4      
7921          1
SORT                                               4          14   
1875008          3
TABLE ACCESS                   EMP                 3          14     
37427          3

6 rows selected.

Thank you very much. Received on Sun May 23 2004 - 21:31:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US