Introduction
When databases store data, the way they organize it can affect how fast and efficient they are. Choosing between storing data by rows or by columns solves different problems depending on how you want to use the data.
Imagine a library where books are either stored by complete volumes on shelves (row-store) or by separating all pages of the same chapter from different books into boxes (column-store). If you want to read a whole book, the shelf method is faster. But if you want to compare a single chapter across many books, the boxes make it easier.
┌───────────────┐ ┌───────────────┐ │ Row-store │ │ Column-store │ ├───────────────┤ ├───────────────┤ │ Record 1: │ │ Column A: │ │ [A1, B1, C1] │ │ A1, A2, A3... │ │ Record 2: │ │ Column B: │ │ [A2, B2, C2] │ │ B1, B2, B3... │ │ Record 3: │ │ Column C: │ │ [A3, B3, C3] │ │ C1, C2, C3... │ └───────────────┘ └───────────────┘