Concept Flow - Column-store vs row-store
Start Query
Choose Storage Type
Row-store
End Query
The flow shows how a database query chooses between row-store and column-store, then reads and processes data accordingly before returning results.
SELECT name, age FROM users WHERE age > 30; -- Row-store reads full rows -- Column-store reads only 'name' and 'age' columns
| Step | Storage Type | Data Access | Data Read | Processing | Output |
|---|---|---|---|---|---|
| 1 | Row-store | Read full rows | All columns of each row | Filter rows where age > 30 | Selected rows with all columns |
| 2 | Row-store | Extract needed columns | From filtered rows | Select 'name' and 'age' | Final output rows with name and age |
| 3 | Column-store | Read only needed columns | 'name' and 'age' columns only | Filter ages > 30 | Filtered columns data |
| 4 | Column-store | Combine columns | Filtered 'name' and 'age' | Form rows for output | Final output rows with name and age |
| 5 | End | Query complete | - | - | Results returned to user |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 4 | Final |
|---|---|---|---|---|---|---|
| Rows Read (Row-store) | 0 | All rows with all columns | Filtered rows (age > 30) | N/A | N/A | Filtered rows with name and age |
| Columns Read (Column-store) | 0 | N/A | N/A | 'name' and 'age' columns | Filtered columns (age > 30) | Filtered columns combined as rows |
| Output Rows | 0 | 0 | Filtered rows with name and age | 0 | Filtered rows with name and age | Final output |
Column-store vs Row-store: - Row-store stores data row by row. - Reading a row reads all columns. - Column-store stores data column by column. - Reading only needed columns speeds queries. - Column-store combines columns back into rows for output.