Oracle壓縮功能介紹

來源:互聯網
上載者:User

大家聽到這個詞,一定就想到了節省硬碟空間吧。沒錯,它就是用來幹這個的,但是向外延伸一下,它不僅可以節省硬碟空間,更可以節省頻寬以及記憶體的使用(cpu有一點點損耗因為需要更多的計算取值操作,但是鑒於大多數環境下cpu都有空閑,所以也可以忽略了)。

Basiccompression這個功能從9i開始就有提供,11gr1開始提供了新的壓縮功能,即OLTP compression。Basic compression是包括在EE版本中的,不需要額外收費,但是OLTP compression則需要額外的Oracle Advanced Compression optionlicense。進階?想用?掏錢吧。

下面的圖片能夠協助你簡單瞭解壓縮塊的原理:

簡單來說,就是在block中會存有特殊的資料結構,symbol table。

Symboltable dump出來的內容如下所示:

tab 0, row 0, @0x1da4    tl: 7 fb: --H-FL-- lb: 0x0  cc: 12    col  0:*NULL*    col  1: [5]  56 41 4c 49 44    col  2: [1]  4e    col  3:*NULL*    col  4: [1]  4e    col  5: [1]  4e    col  6: [3]  53 59 53    col  7: [7]  78 6f 0a 1e 0d 39 19    col  8:[19]  32 30 31 31 2d 31 30 2d 33 30 3a 3132 3a 35 36 3a 32 34    col  9: [2]  c1 05    col 10: [ 5] 49 4e 44 45 58    col 11: [ 7] 78 6f 0a 1e 0d 39 19    bindmp: 00 2a 0c 15 20 24 22

真正的資料內容如下所示:

tab 0, row 0, @0x1da4    tl: 7 fb: --H-FL-- lb: 0x0  cc: 12    col  0:*NULL*    col  1: [5]  56 41 4c 49 44    col  2: [1]  4e    col  3:*NULL*    col  4: [1]  4e    col  5: [1]  4e    col  6: [3]  53 59 53    col  7: [7]  78 6f 0a 1e 0d 39 19    col  8:[19]  32 30 31 31 2d 31 30 2d 33 30 3a 3132 3a 35 36 3a 32 34    col  9: [2]  c1 05    col 10: [ 5] 49 4e 44 45 58    col 11: [ 7] 78 6f 0a 1e 0d 39 19    bindmp: 00 2a 0c 15 20 24 22

有點類似於clustertable的block結構。簡單來說就是只將block重複的內容存放一份到symbol table中,真正的表row piece引用存放在symbol table中的重複的內容。因為Basiccompression和OLTPcompresssion都是塊內壓縮,所以就算擁有重複的內容,但是如果不在同一個塊記憶體放,還是無法達到壓縮的效果。其原理先介紹到這,如果想要深入研究,可以參考老熊的blog。

Oracle壓縮表資料區塊格式解析:

http://www.laoxiong.net/dissect_compressed_block_part1.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.