• <ul id="mayc0"></ul>
    <ul id="mayc0"><center id="mayc0"></center></ul>
    <strike id="mayc0"><input id="mayc0"></input></strike>
    <ul id="mayc0"></ul>
  • 始創于2000年 股票代碼:831685
    咨詢熱線:0371-60135900 注冊有禮 登錄
    • 掛牌上市企業
    • 60秒人工響應
    • 99.99%連通率
    • 7*24h人工
    • 故障100倍補償
    您的位置: 網站首頁 > 幫助中心>文章內容

    通過設置SQLPLUS ARRAYSIZE(行預取)加快SQL返回速度

    發布時間:  2012/8/24 17:26:57

    有時候你可能會用SQLPLUS spool 表的數據,那么怎么加快spool速度呢?SQLPLUS中有個行預取的選項

    SQLPLUS中 arraysize默認為15

    SQL> show arraysize
    arraysize 15

    它表示從Oracle服務器端一次只傳遞15行記錄到客戶端(SQLPLUS),當然了JDBC,WEBLOGIC也有行預取,具體自己Google
    -
     

    舉個例子:

    SQL> select * from test where owner='ADWU_OPTIMA_AP11';

    773 rows selected.

    Elapsed: 00:00:30.95

    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 217508114

    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |   593 |   134K|   882   (3)| 00:00:03 |
    |*  1 |  TABLE ACCESS FULL| TEST |   593 |   134K|   882   (3)| 00:00:03 |
    --------------------------------------------------------------------------

    Predicate Information (identified by operation id):
    ---------------------------------------------------

       1 - filter("OWNER"='ADWU_OPTIMA_AP11')


    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
           2976  consistent gets
              0  physical reads
              0  redo size
          50484  bytes sent via SQL*Net to client
            597  bytes received via SQL*Net from client
             53  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            773  rows processed

    SQL> set arraysize 5000
    SQL> select * from test where owner='ADWU_OPTIMA_AP11';

    773 rows selected.

    Elapsed: 00:00:16.06

    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 217508114

    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |   593 |   134K|   882   (3)| 00:00:03 |
    |*  1 |  TABLE ACCESS FULL| TEST |   593 |   134K|   882   (3)| 00:00:03 |
    --------------------------------------------------------------------------

    Predicate Information (identified by operation id):
    ---------------------------------------------------

       1 - filter("OWNER"='ADWU_OPTIMA_AP11')


    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
           2927  consistent gets
              0  physical reads
              0  redo size
          47800  bytes sent via SQL*Net to client
            241  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            773  rows processed

    當設置 arraysize 之后,SQLPLUS 客戶端與數據庫Server端交互次數明顯減少,這就是為什么返回773行數據第二次比第一次快1倍了,同時也可以看到,第二次邏輯讀比第一次低了,那說明設置行預取會影響邏輯讀。


    本文出自:億恩科技【www.vbseamall.com】

    服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經營性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經營性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經營性ICP/ISP證:贛B2-20080012
  • 服務器/云主機 24小時售后服務電話:0371-60135900
  • 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
  • 專注服務器托管17年
    掃掃關注-微信公眾號
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權所有  地址:鄭州市高新區翠竹街1號總部企業基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師   京公網安備41019702002023號
      0
     
     
     
     

    0371-60135900
    7*24小時客服服務熱線