Row vs Columnar Storage
What is the difference between row-oriented and column-oriented storage, and why does it matter for analytics?
Answer out loud in under a minute: a definition, one concrete example, and one pitfall or trade-off.
Hints
Hint 1
Think about which bytes a query over three columns of a hundred-column table has to read in each layout.
Solution
Show the approach
The short version
Row storage keeps all the fields of one record together, so fetching or updating a record touches one place. Columnar storage keeps all the values of one column together, so a query reads only the columns it references, and similar values sitting side by side compress very well.
Example
SELECT AVG(amount) FROM orders WHERE region = 'EU' over a hundred-column table reads two columns in a columnar layout and every byte of every row in a row layout.
Pitfall
Columnar stores are poor at single-row updates and point lookups, since a record is scattered across column files; they handle it with immutable files and rewrite-on-update, which is why they pair with batch or micro-batch ingestion.