You are on page 1of 6

Lab 04 – Columnar Compression IBM Software

Lab 04 Columnar Compression


Check Overall File System Usage
__1. In this VM, we prebuilt 3 databases DB2DB (uncompressed), ROWDB (compressed using row
organized tables, and COLDB (compressed using column organized tables).

__2. In GNOME Command window, type cd4 to change the directory to Lab 04.
$ cd4

__3. Maximize GNOME Terminal window.

__4. Run compress01 to find out the storage paths used by all 3 databases.
$ ./compress01

IBM DB2 10.5 BLU Acceleration Page 39


IBM Software Lab 04 – Columnar Compression

__5. Run df –h command to find out the file system sizes for above database storage paths.
$ df -h

__6. Please notice that the size of the row organized uncompressed database (DB2DB) is 20GB
compared to 10.4 GB of compressed row organized database (ROWDB).

Check Table Sizes


__7. The database size of column organized database (COLDB) is 4.7 GB which is 4 times smaller
than the uncompressed database (DB2DB) and 2 times smaller than the compressed row
organized database (ROWDB).

__8. Run compress02 to determine the size of tables and compare the sizes with the other
databases.
$ ./compress02

Page 40 An IBM Proof of Technology


Lab 04 – Columnar Compression IBM Software

__9. Please notice that the size of tables (including index and other objects) is 5.19 times smaller than
the original uncompressed database size.

__10. Run compress03 to check sizes of the individual tables in all 3 different databases.
$ ./compress03

IBM DB2 10.5 BLU Acceleration Page 41


IBM Software Lab 04 – Columnar Compression

__11. Run compress04 to check sizes of the individual tables (including indexes) from 3 different
databases and how they compare with each other with compression ratios.
$ ./compress04

__12. Please note from the output from the script compress04 that BLU.FACT_RX shows 8.49 times
compression ratio whereas BLU.PRODUCT shows 1.15 times compression ratio.

Check Percent Pages Saved for Tables


__13. Run script compress05 to check the percent pages saved and compression ratios for the
columnar tables. [Note: This does not include index.]
$ ./compress05

Note: The script compress04 shows compression ratio for table FACT_RX 8.49
times whereas compress05 shows it as 4.34 only.

This is due to the fact that the script compress04 includes indexes size
along with table size whereas compress05 script takes into account only
the table size.

Page 42 An IBM Proof of Technology


Lab 04 – Columnar Compression IBM Software

Check Percent Pages Saved for Indexes


__14. Run script compress06 to check the size of indexes on each table.
$ ./compress06

__15. Please note the following from the above output.

__a. Column organized tables do not need indexes except internal indexes which keep track of
the disk page map with Tuple Sequence Number (TSN) stored in the synopsis table for
each column organized table.

__b. The fact tables FACT_RX and FACT_DX in DB2DB and ROWDB databases contain several
indexes required to meet the needs of the different queries.

__c. There is no external indexes required on fact tables when they are created as column
organized. This frees up the space required by indexes which sometime can be greater
than the size of the individual table.

__d. Please notice that the index space saving for the FACT_RX tables is 1848 times mainly due
to the fact that the internal index size is very small in column organized table.

__e. The space saving realized is more when the size of the table is large, which is typically the
case with the large fact tables in an analytics database.

IBM DB2 10.5 BLU Acceleration Page 43


IBM Software Lab 04 – Columnar Compression

Check Percent Encoding for Columns


__16. Run script compress07 to check the percent encoding for the columns for the columnar tables.
$ ./compress07

__17. Please notice that the percent encoding at the column level is more than 90% for all columns
except FACT_RX.VISIT_KEY column which is VARCHAR(26) holding numeric data.

__18. Type clear.


$ clear

** End of Lab 04: Columnar Compression

Page 44 An IBM Proof of Technology

You might also like