Data compression in SAP HANA


In SAP HANA, there are various methods and algorithms that you can use to store data in Column based structure- Dictionary Compressed, Run Length Compressed and many more.

In Dictionary Compressed, cells are stored in form of numbers in tables and numeral cells are always performance optimized as compared to characters.

In Run length compressed, it saves the multiplier with cell value in numerical format and multiplier shows repetitive value in the table.

Compression is calculated using Compression factor. Compression factor refers to the ratio of the uncompressed data size to the compressed data size in SAP HANA.

In SAP HANA, Compression is performed and calculations are done as part of the delta merge operation. If you create an empty column table, no compression is applied initially as the database cannot know which method is most appropriate. As you start to insert data into the table and the delta merge operation starts being executed at regular intervals, data compression is automatically (re)evaluated and optimized.

Automatic compression optimization is ensured by the parameter active in the optimize_compression section of the index server.ini configuration file. This parameter must have the value yes.

To find compression details, you need to first load the table into memory. You can also load a table using SQL command. Open the SQL console and execute the following statement −

LOAD <table_name>
UNLOAD <table_name>

Note that when you load a table, it loads the complete data and also delta storage into the main memory of SAP HANA system.

To perform data compression, run the following SQL command to check data compression properties.

PUBLIC.M_CS_COLUMNS where SCHEMA_NAME = '<your_schema>' and TABLE_NAME = '<your_table>

Published on 23-Apr-2018 10:31:37