Data Compression in the Column Store
SAP HANA 数据库的列存储数据有两类压缩：
- 字典压缩 (Dictionary compression): This default method of compression is applied to all columns. It involves the mapping of distinct column values to consecutive numbers, so that instead of the actual value being stored, the typically much smaller consecutive number is stored.
- 高级压缩 (Advanced compression): Each column can be further compressed using different compression methods, namely prefix encoding, run length encoding (RLE), cluster encoding, sparse encoding, and indirect encoding. The SAP HANA database uses compression algorithms to determine which type of compression is most appropriate for a column. Columns with the PAGE LOADABLE attribute are compressed with the NBit algorithm only.
select SCHEMA_NAME, TABLE_NAME, MEMORY_SIZE_IN_TOTAL from PUBLIC.M_CS_TABLES where SCHEMA_NAME='SCHEMA_NAME' and TABLE_NAME='TABLE_NAME'; select compression_type, index_type, implementation_flags, count(*) from m_cs_columns where schema_name not like '%SYS%' group by compression_type, index_type, implementation_flags order by count(*) desc