• <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倍補償
    您的位置: 網站首頁 > 幫助中心>文章內容

    InnoDB與Oracle單行存儲長度對比

    發布時間:  2012/8/10 17:51:03

    眾所周知,MySQL InnoDB存儲引擎與Oracle非常相似,支持事務,row-locking,經過實際測試,innodb與oracle一個比較大的差異點為,相同數據,innodb單行存儲長度大概是oracle單行存儲長度的1.8倍。
    測試的表,常見的各種類型都有,number,varchar2,date

    --首先在Oracle中做測試 , 在Oracle數據庫中此表單行長度平均為458字節
    -
     

    09:49:45 danchen@ test_Oracle>select blocks from dba_extents where segment_name='test_dc' and rownum<2;

        BLOCKS
    ----------
          1280

    1 row selected.

    09:52:55 danchen@ test_Oracle>select /*+ rowid(u)*/  count(*) from test_dc u where rowid>=CHARTOROWID('AAADQdAA6AAADcJAAA') and rowid<=CHARTOROWID('AAADQdAA6AAADwICcQ');

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

         22852

    09:54:55 danchen@ test_Oracle>select 1280*8*1024/22852 bytes from dual;

         BYTES
    ----------
    458.855242

    --在mysql作對比測試
    root@test_mysql 09:47:47>select count(*) from test_dc_181;
    +----------+
    | count(*) |
    +----------+
    |   128928 |
    +----------+
    1 row in set (0.08 sec)

    root@test_mysql 09:45:57>show table status like 'test_dc_181'\G;
    *************************** 1. row ***************************
               Name: test_dc_181
             Engine: InnoDB
            Version: 10
         Row_format: Compact
               Rows: 85668   --統計信息不準確
     Avg_row_length: 1122
        Data_length: 96141312
    Max_data_length: 0
       Index_length: 0
          Data_free: 0
     Auto_increment: NULL
        Create_time: 2009-05-27 11:23:55
        Update_time: NULL
         Check_time: NULL
          Collation: gbk_chinese_ci
           Checksum: NULL
     Create_options:
            Comment: InnoDB free: 292984832 kB
    1 row in set (0.00 sec)

    ERROR:
    No query specified


    --重新分析一下,發現執行分析操作時間非常快,數據也比較準確,估計mysql的分析的算法原理為基于抽樣的統計,比如說一個page里有多少記錄,總的page數是多少,兩者相乘即可得到行數。
    root@test_mysql 09:46:01>analyze table test_dc_181;
    +---------------------+---------+----------+----------+
    | Table               | Op      | Msg_type | Msg_text |
    +---------------------+---------+----------+----------+
    | test_mysql.test_dc_181 | analyze | status   | OK       |
    +---------------------+---------+----------+----------+
    1 row in set (0.00 sec)

    root@test_mysql 09:46:46>show table status like 'test_dc_181'\G;
    *************************** 1. row ***************************
               Name: test_dc_181
             Engine: InnoDB
            Version: 10
         Row_format: Compact
               Rows: 115074
     Avg_row_length: 835
        Data_length: 96141312
    Max_data_length: 0
       Index_length: 0
          Data_free: 0
     Auto_increment: NULL
        Create_time: 2009-05-27 11:23:55
        Update_time: NULL
         Check_time: NULL
          Collation: gbk_chinese_ci
           Checksum: NULL
     Create_options:
            Comment: InnoDB free: 292984832 kB
    1 row in set (0.00 sec)

    ERROR:
    No query specified

    --在mysql innodb的表中平均單行長度為835字節

    root@test_mysql 09:46:50>select 96141312/115074;
    +-----------------+
    | 96141312/115074 |
    +-----------------+
    |        835.4738 |
    +-----------------+
    1 row in set (0.00 sec)


    --同一行記錄,在Oracle與mysql存儲空間對比為1.8:1,所以在做容量估計的時候要注意。
    root@test_mysql 09:48:14>select 835.4738/458.855242 ;
    +---------------------+
    | 835.4738/458.855242 |
    +---------------------+
    |          1.82077859 |
    +---------------------+
    1 row in set (0.00 sec)


    本文出自:億恩科技【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小時客服服務熱線