Stage 5 · Architecture patterns · Medium · 15 min
Analytics storage: row stores and column stores
A row store keeps each record together. A column store keeps each field together. Learn which one serves an app, which one serves reports, and why.
What each interview level is expected to know
Learn first: Indexes and storage engines, Stream and batch processing
After this lesson you can:
- Explain why a report over one field reads less data in a column store.
- Choose a row store or a column store from the questions a system must answer.
- Describe how data reaches the column store, and how old a report can be.
Start here
See it in 60 seconds
Row storage against column storage
A report that needs one field reads every field in a row store, but only that field's file in a column store.
Scene 1 of 6 · One report question
A report asks for the average order amount across 1,000,000 orders, each with 10 fields.
- Report — healthy — average of amount
- Row store — healthy
- Column store — healthy
- One report question. A report asks for the average order amount across 1,000,000 orders, each with 10 fields.
- Rows sit together. A row store keeps all 10 fields of each order side by side, like one line of a spreadsheet.
- It reads whole rows. To get the amounts, it reads every whole row: 80 MB, though the report needs one field.
- Columns sit together. A column store keeps all 1,000,000 amounts in one file, and each other field in its own.
- It reads one column. The same report reads only the amount file: 8 MB, which is 10 times less.
- Each has its job. Row stores suit apps that fetch one whole order, and column stores suit reports over millions of rows.
- Now you try. Say the report uses more fields of each order. How many of the 10 fields does it read? For example: Row store: 80 MB. Column store: 8 MB, 10 times less. The row store reads every field of every row, while the column store reads only the fields used.
Scene 1 of 6: One report question. A report asks for the average order amount across 1,000,000 orders, each with 10 fields.
Key points
- A row store keeps each record's fields together on disk.
- A column store gives every field a file of its own, for all records.
- Busy apps fetch whole records, so they suit a row store.
- Reports sum a few fields over millions of rows, so they suit a column store.
In plain words
Say a shop keeps 1,000,000 orders, and each order has 10 fields: the user, the amount, the country and so on. A row store keeps the 10 fields of one order side by side. Opening order 7 is one small read. A column store keeps each field in its own file, so all 1,000,000 amounts sit together. Adding up the amounts then reads one file and skips the other 9. Apps fetch and change single records, so they use row stores. Reports add up a few fields over many records, so they use column stores. A column store built for reports is often called a data warehouse.
Think about the question before the store. A question about one record, such as "show order 7", wants all the fields of that record. A row store keeps them together. A question about many records, such as "total sales this year", wants one or two fields from every record. A column store keeps each field together. Most systems run both: the app uses the row store, and a copy in the column store answers the reports.
The problem it solves
The app's database is laid out for single records. A report that adds up one field over a year of orders must still read every field of every order. On the same database, that long read also competes with customers' requests. The report is slow, and it can slow the shop down too.
Why it matters
A product has two kinds of question to answer. The app asks for one order. The business asks for sales by country this year. One store rarely serves both well. Metrics, ad-click and dashboard designs all depend on this choice, so interviewers expect you to say where the reports run.
A worked example
A shop has 1,000,000 orders with 10 fields of 8 bytes each, 80 MB in all. A total of the amounts reads 80 MB from a row store and 8 MB from a column store. Opening one order is 1 read in the row store and 10 reads in the column store.
Think of it like…
Think of a stack of paper order forms. To read one order, you pull one form. To add up every amount, you must turn every form. Now copy all the amounts onto one sheet, in order. Adding them up means reading one sheet.
Where this analogy stops working
The single sheet shows why a report is quick. It does not show the cost: a new order must be written onto ten sheets, one for each field. A real column store also packs each sheet into less space, which paper cannot do.
Try it
See it working
Pick the fields the report uses
This report uses 1 of 10 fields. The row store reads 80 MB. The column store reads 8 MB.
Row store: one strip for each order
80 MB read. Every order is read whole. 72 MB of it is fields the report does not use.
Column store: one strip for each field
8 MB read. 1 file is read. The other 9 are skipped.
read and used read, not used skipped
4 orders are drawn. The sizes are for 1,000,000 orders at 8 bytes a value, before any packing.
Also try: Batch jobs: map, shuffle, reduce · Storage engines: B+ tree vs LSM tree
Mechanics
How it works
The pictures use one orders table: 1,000,000 orders, 10 fields and 8 bytes a value. The whole table is 80 MB, and one field is 8 MB.
A report reads one field
Pick a case to follow belowWith this case: The row store read 80 MB for this report, all 10 fields of every order, to add up one field.
Report, asks one question, NOW Report asks one question needs 1 field NOW Row store, one line per order Row store one line per order - Report — asks one question — healthy — NOW — needs 1 field
- Row store — one line per order — healthy
- Question
- Data read
- Answer
Step 1 of 3Step 1 of 3 · Report
Done: The report asks for one total
- What happens
- The report wants the amount of all 1,000,000 orders added up.
- Why
- It needs 1 of the 10 fields, but it needs that field from every order.
- What changes
- The store must now find every amount.
- Next
- The store reads every whole row
Data read0 MBof 80 MB in the tableFields the report needs1 of 10the amountStep 1 of 3: Report. The report asks for one total. The report wants the amount of all 1,000,000 orders added up.
A report asks for the total amount of all orders. It needs one field, from every order. A row store keeps each order's fields together, so it reads whole rows. A column store keeps each field in its own file, so it reads only the amount file.
In the picture, the row store reads 80 MB to add up one field. The column store reads the amount file, 8 MB, which is 10 times less. A report that used all 10 fields would read 80 MB in both stores.
An app reads one record
Pick a case to follow belowWith this case: The row store made 1 read for the whole order, because its fields sit together.
App, shows one order, NOW App shows one order wants order 7 NOW Row store, one line per order Row store one line per order - App — shows one order — healthy — NOW — wants order 7
- Row store — one line per order — healthy
- Question
- Data read
- Answer
Step 1 of 3Step 1 of 3 · App
Done: The app asks for order 7
- What happens
- A customer opens order 7. The page shows all 10 fields of that one order.
- Why
- An app works on one record at a time, and it wants the whole record.
- What changes
- The store looks up where order 7 is kept.
- Next
- The store reads one row
Reads for the fields0the fields sit togetherFields the app needs10 of 10the whole orderStep 1 of 3: App. The app asks for order 7. A customer opens order 7. The page shows all 10 fields of that one order.
The app asks for order 7 with all its fields. Here the row store wins. The fields sit together, so one read brings the whole order. The column store must visit every field's file and put the order back together.
In the picture, the row store makes 1 read for the order's fields. The column store makes 10 reads, one in each file. This is why the app's own database stays a row store.
A column packs into less space
Pick a case to follow belowWith this case: As written, the country file is 8 MB.
Report, orders by country Report orders by country Column store, one file per field, NOW Column store one file per field country: 8 MB NOW - Report — orders by country — healthy
- Column store — one file per field — healthy — NOW — country: 8 MB
- Data read
Step 1 of 1Step 1 of 1 · Column store
Done: The country file as written
- What happens
- The file holds the country of each order, 8 bytes a value: 8 MB for 1,000,000 orders.
- Why
- There are only 200 countries, so the same few values repeat all through the file.
- What changes
- A report by country reads 8 MB.
- Next
- The run ends here.
How it ended. As written, the country file is 8 MB.
Size of the country file8 MB1,000,000 ordersDifferent countries200Step 1 of 1: Column store. The country file as written. The file holds the country of each order, 8 bytes a value: 8 MB for 1,000,000 orders.
A file that holds one field is full of values of the same kind, and many repeat. The store can swap each value for a short code. If the table is sorted by that field, it can keep each value once, with a count. Smaller files mean less to read, so reports get faster again.
In the picture, the country file is 8 MB as written. With 1-byte codes for its 200 countries, it is 1 MB. Sorted by country and kept as runs, it is 1,000 bytes. That last saving needs the sort: in a table sorted by time, the runs would be short.
New data arrives in batches
Pick a case to follow belowWith this case: The row store took 1 write for 1 order.
Shop, takes new orders, NOW Shop takes new orders 1 new order NOW Row store, one line per order Row store one line per order - Shop — takes new orders — healthy — NOW — 1 new order
- Row store — one line per order — healthy
- New orders
- Write
Step 1 of 2Step 1 of 2 · Shop
Done: One new order arrives
- What happens
- A customer pays, and the shop sends the new order, with its 10 fields, to the store.
- Why
- A shop takes orders one at a time, as customers pay.
- What changes
- The store must now save the new data.
- Next
- The store adds one row
Writes0one rowOrders added0Step 1 of 2: Shop. One new order arrives. A customer pays, and the shop sends the new order, with its 10 fields, to the store.
What these pictures simplify. These pictures use round sizes: 1,000,000 orders, 10 fields and 8 bytes a value, so the counts come out exact. A real store reads and writes in blocks of many values, and keeps busy data in memory. It saves new data in small files that it joins later. A row store can also add an index that holds one field. The numbers change, and the shape of the result stays.
Writing is where a column store pays. One new order has a value for every file. So a column store collects many orders and adds them in one load. Its reports then see data as old as the last load, which may be seconds or hours.
In the picture, a row store takes 1 write for one order. A column store takes 10 writes for one order, and the same 10 writes for 10,000 orders.
Keep both, and copy between them
Most systems keep both stores. The app writes to its row store. A copy job moves new and changed records to the column store, as a batch each hour or night, or as a stream of changes. Reports run on the copy, so a heavy report does not slow the app.
Use it when
- Dashboards and reports that add up or count a few fields over millions of records, such as sales by country for each month.
- Event data such as clicks, page views and logs: it is written once, then read in bulk.
- Questions nobody planned for: an analyst can filter and group by any field, with no (An extra structure, kept sorted or grouped, that lets a database find matching items without reading all of them.) built for each one.
- Long history: columns that pack well hold years of data in less space.
Skip it when
- The app's own reads and writes of single records, such as placing or showing one order: use a row store.
- Data that changes often in place: updating one record in a column store touches many files.
- A small table: a row store reads a few thousand rows quickly, so a second store adds only work.
- Answers that must include the last second of data, unless a stream loads the column store.
Check yourself
Judgement
Trade-offs and how it fails
What you give up
- Reads vs writes
- A column store makes wide reads over one field cheap, and single-record work costly. A row store does the opposite. Choose by the questions asked, not by the size of the data.
- Freshness
- Reports on a copy are behind the app by the time since the last load. A stream of changes cuts that to seconds, and costs more to run than a nightly batch.
- Two stores
- A second store means a copy job to run and watch. When it fails or falls behind, the reports are old or wrong, and no customer page shows it.
Failure modes
- Reports on the app's database: a long read uses the disk and memory that customers' requests need, and the shop slows down. Run reports on a copy.
- One row at a time into a column store: each insert makes many small writes, and the loads fall behind. Collect rows and insert them in batches.
- The copy job stops and nobody sees: dashboards keep showing old numbers that look current. Show the time of the last load on each report, and alert when it is late.
- Asking for every field: such a query reads the whole table, so the column layout saves nothing. Ask only for the fields the report uses.
- Rows counted twice: a load retried after a failure adds the same rows again. Give each batch an id, and make the load skip a batch it has seen.
In the real world
- Google's Dremel paper (2010) describes a query system for very large tables. It says a column layout, combined with a tree of servers, lets it run adding-up queries over trillion-row tables in seconds. Source: Google Research: the Dremel paper (2010) (checked 11 November 2026)
- Amazon's Redshift guide gives the example of a table with 100 columns. A query that uses 5 of them reads about 5% of the data. A row store would read the blocks that hold the other 95 columns as well. Source: Amazon Redshift guide: Columnar storage (checked 11 November 2026)
- The ClickHouse guide advises inserting at least 1,000 rows at a time, and ideally 10,000 to 100,000. It says fewer, larger inserts mean fewer parts to write and less merging. Source: ClickHouse docs: Bulk inserts (checked 11 November 2026)
Check yourself
Interview
What interviewers look for
- Split the two kinds of work early: "Orders are served from a row store. Reports run on a column store fed from it."
- Give the reason in numbers: "The report needs 1 field of 10, so a column store reads a tenth of the data."
- Say how the data gets there and how old it is: "A change stream loads the warehouse, so dashboards are about a minute behind."
- Name the cost: "Single-row updates are slow there, so we load in batches and never serve the app from it."
Say it out loud: Why does a report that adds up one field run faster on a column store than on a row store?
Expected depth by interview level
Levels describe the depth interviewers probe, not years of experience. Choose a level on the learning path to highlight it.
- JuniorUseful
- Apps and reports want different stores.
- MidUseful
- Why a report over one field is slow in a row store.
- SeniorCore
- Column layout, compression, batch loads, and how data reaches the warehouse.
- StaffExpected
- Choosing the analytics store, and how fresh its data must be.
Practice
Apply it
Three harder questions
The first two use the idea on a new case. The last asks you to judge a design.
Apply it
Apply it
Judge a design
Go deeper
Sources and further reading
First-hand sources to check this page against and to go further. They are standards, official docs, original papers, and guides from engineering and security teams. Each link was opened on 8 November 2026.
- Research paperDremel: Interactive Analysis of Web-Scale Datasets (2010)Melnik et al., VLDBA column layout and a tree of servers for adding-up queries over very large tables.
- Official docsColumnar storageAmazon Redshift Database Developer GuideWhy keeping a column together cuts the data a query reads, with a worked example.
- Official docsWhat is a columnar database?ClickHouse documentationReading only the columns a query uses, and the higher cost of work on whole rows.
- Official docsParquet overviewApache ParquetAn open file format that stores data by column, used by many analytics systems.