Arraysize的設定以及對查詢效能的影響

來源:互聯網
上載者:User

Arraysize是sql*plus中可以設定的一個參數,這個參數設定的意思表示,sql*plus一次可以從資料庫伺服器端擷取的記錄行數。

show arraysize

arraysize 15

可以看到,在SQL*plus中,預設設定是15。有效值是1-5000。按照《Oracle9i Database Performance Tuning Guide and Reference Release 2》的說法,當這個值的設定超過100後,對效能改進基本上不會有多少協助了。

在OCI和OCCI中,都可以設定這個參數,

例如,在OCCI中設定這個參數的函數是:setPrefetchRowCount()。

 

做個簡單的實驗:

create table t as select * from all_objects;

set autotrace traceonly statistics;

 

set arraysize 2

select * from t;

 

統計資訊

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

        288  recursive calls

          0  db block gets

      25300  consistent gets

        682  physical reads

          0  redo size

    8135852  bytes sent via SQL*Net to client

     273691  bytes received via SQL*Net from client

      24848  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 5

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

      10477  consistent gets

          0  physical reads

          0  redo size

    6197846  bytes sent via SQL*Net to client

     109703  bytes received via SQL*Net from client

       9940  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 10

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

       5588  consistent gets

          0  physical reads

          0  redo size

    5551876  bytes sent via SQL*Net to client

      55044  bytes received via SQL*Net from client

       4971  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 15

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

       3952  consistent gets

          0  physical reads

          0  redo size

    5336466  bytes sent via SQL*Net to client

      36817  bytes received via SQL*Net from client

       3314  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 100

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

       1178  consistent gets

          0  physical reads

          0  redo size

    4970386  bytes sent via SQL*Net to client

       5841  bytes received via SQL*Net from client

        498  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 500

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

        786  consistent gets

          0  physical reads

          0  redo size

    4918776  bytes sent via SQL*Net to client

       1474  bytes received via SQL*Net from client

        101  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

      49693  rows processed

 

set arraysize 5000

select * from t;

 

統計資訊

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

          0  recursive calls

          0  db block gets

        697  consistent gets

          0  physical reads

          0  redo size

    4907076  bytes sent via SQL*Net to client

        484  bytes received via SQL*Net from client

         11

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.