IntermediateAbout 12 min

    Column-Oriented Storage

    Read the full article on Substack

    7 min read.

    Answer one analytics query from a row store and a column store, count the cells each reads, then compress a sorted column with run-length encoding.

    Think of it this way: A row store is a stack of order forms: to total every price you must flip through every whole form. A column store is a set of ledgers, one per field. To total prices you open just the price ledger and the country ledger, and line number 5 in each refers to the same order.

    SUM(price) WHERE country = 'CA'cells read: 0, sum 0
    idcountryproductqtyprice
    1CAmug212
    2CApen53
    3CAcap120
    4MXmug312
    5MXpen43
    6UScap220
    7USmug112
    8USpen63

    Find the total price of orders from CA. A row store keeps each order together on disk.

    1/10

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Row store or column store?

    Sort

    Sort each workload or trait by the layout it fits.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Row store

    Drop items here

    Column store

    Drop items here
    6 pieces left to place

    Quiz

    8 questions
    Question 1 of 8
    Score: 0

    Which workload benefits most from a column store?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going