Here is an attempt to explain the row store data layout, column store data layout and data compression technique.
Row Store : Here all data connect to a row is placed next to each other. See below an example.
Table 1 :
Name | Location | Gender |
….. | ….. | …. |
Sachin | Mumbai | M |
Sania | Hyderabad | F |
Dravid | Bangalore | M |
……. | …… | …… |
Row store corresponding to above table is
Image may be NSFW.
Clik here to view.
Column store : Here contents of a columns are placed next to each other. See below illustration of table 1.
Image may be NSFW.
Clik here to view.
Data Compression : SAP HANA provide series of data compression technique that can be used for data in the column store. To store the contents of a column , the HANA database creates minimum two data structures. A dictionary vector and an attribute vector. See below table 2 and the corresponding column store.
Table 2.
Record | Name | Location | Gender |
….. | ….. | ….. | …. |
3 | Blue | Mumbai | M |
4 | Blue | Bangalore | M |
5 | Green | Chennai | F |
6 | Red | Mumbai | M |
7 | Red | Bangalore | F |
…… | ….. | …… | …… |
Image may be NSFW.
Clik here to view.
Here in the above example the column ‘Name’ has repeating values ‘Blue’ and ‘Red’. Similarly for ‘Location’ and ‘Gender’. The dictionary vector stores each value of a column only once in a sorted order and also a position is maintained against each value. With reference to the above example , the dictionary vectors of Name , Location and Gender could be as follows.
Dictionary vector : Name
Name | Position |
…. | …… |
Blue | 10 |
Green | 11 |
Red | 12 |
….. | …… |
Dictionary vector : Location
Location | Position |
…. | …… |
Bangalore | 3 |
Chennai | 4 |
Mumbai | 5 |
….. | …… |
Dictionary vector : Gender
Gender | Position |
F | 1 |
M | 2 |
Now the Attribute vector corresponding to the above table 2 would be as follows. Here it stores the integer values , which is the positions in dictionary vector.
So the column store for above mentioned table 2 can be converted as combination of Dictionary and attribute vectors.