DB2 table Compression

Source: Internet
Author: User
In fact, the DB2 table is compressed by viewing the entire table, finding duplicate characters and strings, and storing those characters and strings in a compression dictionary, then, an alternative symbol of the corresponding data string stored in the dictionary is used to represent the actual data, thus compressing the data. A compressed Attribute Table must have its corresponding compression dictionary.

 

Enable table compression:

SQL Code
  1. Create TableTablename compress yes orAlter TableTablename compress Yes

 

Scan the table, create the corresponding compression dictionary, and execute the actual table reorganization to compress the data (each table has its own compression dictionary, and the newly inserted data will be compressed ):

SQL code
  1. ReorgTableTablename resetdictionary

 

If you want to reorganize a compressed table, instead of recreating a data dictionary, then:

SQL code
  1. ReorgTableTablename keepdictionary

 

Before compression, we usually want to evaluate how much space can be saved after table compression by using the DB2 inspect and db2inspf commands:

SQL code
  1. DB2 inspect rowcompestimate table name tbname results keep tbfile
  2. Db2inspf tbfile alantab_output_resultfile

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.