同樣SQL同樣執行計劃在不同節點執行時間差很遠

tolywang發表於2011-02-13
Oracle 10.2.0.4 ,   Linux AS 5.4  64bit , 4 Nodes RAC


設定上因為節點4是作為report用處的,所以我們將它與其他3個節點徹底分割開(透過remote_listener=''來設定,其他節點
都有設定), 同樣的一個report SQL ,在4個節點上的cost及執行步驟,執行計劃一模一樣, 但是在專用於report的節點4上
執行比較快 (大約1分鐘), 但是在其他節點居然需要 8 分多鐘, 我是在平常生產階段做的測試, 其他同事在非生產階段(比較
少的DML) 做測試也是一樣 。 4個節點的前端Server配置及OS配置都一樣。 節點1,2,3用於OLTP生產系統, 而節點4主要
用於報表查詢, web中也有很少量的insert, update維護動作, 而且1,2,3的負載比較低, 平均只有 2.5 左右 (24核CPU),
節點4負載稍微高一些,平均 8.5 左右 。

sga設定了20G, 節點1,2,3 buffer cache 命中率約為 99.5% 左右,節點4為 99.91% .

檢視一下sql trace統計,不一樣的地方是主要是 physical reads , 節點4上是9w多, 節點1,2,3是30w左右 。



以下統計前提都是在每個節點上事先有執行過這個相同SQL .





在節點4上的2次統計:  

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
    1124242  consistent gets
      96969  physical reads
        220  redo size
    1234109  bytes sent via SQL*Net to client
      15789  bytes received via SQL*Net from client
        721  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
      10798  rows processed

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
    1125569  consistent gets
      93146  physical reads
        860  redo size
    1258173  bytes sent via SQL*Net to client
      15910  bytes received via SQL*Net from client
        732  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
      10957  rows processed


在節點1上的2次統計:  

Statistics
----------------------------------------------------------
          1  recursive calls
          0  db block gets
    1135486  consistent gets
     289516  physical reads
        116  redo size
    1234703  bytes sent via SQL*Net to client
      15800  bytes received via SQL*Net from client
        722  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
      10802  rows processed

Statistics
----------------------------------------------------------
          1  recursive calls
          0  db block gets
    1133003  consistent gets
     306163  physical reads
          0  redo size
    1258394  bytes sent via SQL*Net to client
      15909  bytes received via SQL*Net from client
        732  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
      10961  rows processed


在節點3上的2次統計:  
Statistics
----------------------------------------------------------
        759  recursive calls
          0  db block gets
    1141367  consistent gets
     338301  physical reads
        552  redo size
    1263503  bytes sent via SQL*Net to client
      15844  bytes received via SQL*Net from client
        726  SQL*Net roundtrips to/from client
         31  sorts (memory)
          0  sorts (disk)
      10865  rows processed

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
    1150321  consistent gets
     347188  physical reads
          0  redo size
    1281392  bytes sent via SQL*Net to client
      15899  bytes received via SQL*Net from client
        731  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
      10948  rows processed

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

相關文章