SAP / SAP Mid Level (3 to 8 yrs) Interview questions
How does data compression work in HANA's columnar storage?
Because a single column typically contains many repeated or similar values (a country code column with only a few dozen distinct values across millions of rows, for instance), HANA applies compression techniques like dictionary encoding: each distinct value is stored once in a compact dictionary, and the actual column data is stored as short numeric references into that dictionary rather than repeating the full value every time.
flowchart LR
A[Column values: US, US, DE, US, DE] --> B[Dictionary: 0=US, 1=DE]
B --> C[Compressed column stored as: 0,0,1,0,1]
This dramatically shrinks the memory footprint of columns with low cardinality (few distinct values), which both reduces the total RAM needed to hold a table and speeds up scans, since less data actually needs to be read and processed for the same logical column. Columns with high cardinality (like a unique ID) compress less dramatically, but HANA applies other techniques (like run-length encoding for sorted or repeated sequences) depending on the column's actual data characteristics.
More Related questions...
