Delete删除表数据时对性能的影响分析(2)

ZLM                                     6       1792   37748736      4608            6

 

SQL> set autot trace

SQL> select count(*) from test1;

 

 

Execution Plan

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

Plan hash value: 3896847026

 

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

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

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

|   0 | SELECT STATEMENT   |       |     1 |     2   (0)| 00:00:01 |

|   1 |  SORT AGGREGATE    |       |     1 |            |          |

|   2 |   TABLE ACCESS FULL| TEST1 |     1 |     2   (0)| 00:00:01 |

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

 

 

Statistics

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

          0  recursive calls

          1  db block gets

       1599  consistent gets

          0  physical reads

          0  redo size

        526  bytes sent via SQL*Net to client

        519  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> delete from test1;

 

1000000 rows deleted.

 

 

Execution Plan

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

Plan hash value: 2642947686

 

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

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

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

|   0 | DELETE STATEMENT   |       |     1 |     2   (0)| 00:00:01 |

|   1 |  DELETE            | TEST1 |       |            |          |

|   2 |   TABLE ACCESS FULL| TEST1 |     1 |     2   (0)| 00:00:01 |

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

 

 

Statistics

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

        814  recursive calls

    1038983  db block gets

       1953  consistent gets

          8  physical reads

  245334988  redo size

        847  bytes sent via SQL*Net to client

        769  bytes received via SQL*Net from client

          3  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

    1000000  rows processed

 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4fefa1de6d06e71ece1c4ca22f8e9641.html