SQL的執行計劃

mengzhaoliang發表於2008-06-25

* 2008/06/25  星期三
*蒙昭良
*環境:WindowsXP + Oracle10gR2
*SQL的執行計劃
*/
SQL> select count(*) from test;

  COUNT(*)                                                                     
----------                                                                     
     51470                                                                     

SQL> set timing on
SQL> select count(*) from test;

  COUNT(*)                                                                     
----------                                                                     
     51470                                                                     

已用時間:  00: 00: 09.89
SQL> set autotrace on
SQL> select count(*) from test;

  COUNT(*)                                                                     
----------                                                                     
     51470                                                                     

已用時間:  00: 00: 03.78

執行計劃
----------------------------------------------------------                     
Plan hash value: 1950795681                                                    
                                                                               
-------------------------------------------------------------------            
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |            
-------------------------------------------------------------------            
|   0 | SELECT STATEMENT   |      |     1 |  4107   (1)| 00:00:50 |            
|   1 |  SORT AGGREGATE    |      |     1 |            |          |            
|   2 |   TABLE ACCESS FULL| TEST | 16763 |  4107   (1)| 00:00:50 |            
-------------------------------------------------------------------            
                                                                               
Note                                                                           
-----                                                                          
   - dynamic sampling used for this statement                                  


統計資訊
----------------------------------------------------------                     
          0  recursive calls                                                   
          0  db block gets                                                     
      15098  consistent gets                                                   
      12361  physical reads                                                    
          0  redo size                                                         
        410  bytes sent via SQL*Net to client                                  
        385  bytes received via SQL*Net from client                            
          2  SQL*Net roundtrips to/from client                                 
          0  sorts (memory)                                                    
          0  sorts (disk)                                                      
          1  rows processed                                                    

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12778571/viewspace-364855/,如需轉載,請註明出處,否則將追究法律責任。

相關文章