OCP043 第十讲Managing Schema Objects(四)

2014-11-24 11:32:19 · 作者: · 浏览: 4
ly completed

SQL> begin

2 for i in 1..100

3 loop

4 insert into hr.t04310_c values (i,sysdate);

5 end loop;

6 commit;

7* end;

PL/SQL procedure successfully completed.

SQL> begin

2 for i in 1..100

3 loop

4 insert into hr.t04310_d values (i,sysdate);

5 end loop;

6 commit;

7* end;

PL/SQL procedure successfully completed.

SQL> exec dbms_stats.gather_table_stats('HR','T04310_C');

PL/SQL procedure successfully completed.

SQL> exec dbms_stats.gather_table_stats('HR','T04310_D');

PL/SQL procedure successfully completed.

SQL> alter system flush buffer_cache;

System altered.

SQL> select * from hr.t04310_c where a=100;

Elapsed: 00:00:00.00

Execution Plan

----------------------------------------------------------

Plan hash value: 1269988501

--------------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time

| Pstart| Pstop |

--------------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 1 | 11 | 3 (0)| 00:00:01

| | |

| 1 | PARTITION HASH SINGLE| | 1 | 11 | 3 (0)| 00:00:01

| 1 | 1 |

|* 2 | TABLE ACCESS FULL | T04310_C | 1 | 11 | 3 (0)| 00:00:01

| 1 | 1 |

--------------------------------------------------------------------------------

Predicate Information (identified by operation id):

---------------------------------------------------

2 - filter("A"=100)

Statistics

----------------------------------------------------------

0 recursive calls

0 db block gets

7 consistent gets

6 physical reads

0 redo size

575 bytes sent via SQL*Net to client

469 bytes received via SQL*Net from client

2 SQL*Net roundtrips to/from client

0 sorts (memory)

0 sorts (disk)

1 rows processed

SQL> alter system flush buffer_cache;

System altered.

SQL> select * from hr.t04310_d where a=100;

Elapsed: 00:00:00.01

Execution Plan

----------------------------------------------------------

Plan hash value: 2640584124

------------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

------------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 51 | 561 | 5 (0)| 00:00:01 |

|* 1 | TABLE ACCESS FULL| T04310_D | 51 | 561 | 5 (0)| 00:00:01 |

------------------------------------------------------------------------------

Predicate Information (identified by operation id):

---------------------------------------------------

1 - filter("A"=100)

Statistics

----------------------------------------------------------

1 recursive calls

0 db block gets

16 consistent gets

14 physical reads

0 redo size

575 bytes sent via SQL*Net to client

469 bytes received via SQL*Net from client

2 SQL*Net roundtrips to/from client

0 sorts (memory)