2 ms·
> What exactly happens under the hood? A row oriented DB puts data in storage by putting for each row all columns after another, and then rows after rows in me
by detaro 4y ago
> What exactly happens under the hood?
A row oriented DB puts data in storage by putting for each row all columns after another, and then rows after rows in memory. A column oriented DB splits storage by columns instead, putting everything thats in a column next to each other.
Given columns A, B, C:
row-oriented:
A1,B1,C1,A2,B2,C2,A3,B3,C3, ...
column oriented:
A1,A2,A3 ... B1,B2,B3, ... C1,C2,C3, ...
Accessing data that's next to each other is faster than accessing data that's split apart, and reading more data takes longer than reading less data - hence the difference in access speeds. (The details are of course more complicated, but this is what the fundamental idea boils down to)