๐Ÿ—‚๏ธ Row vs. Column Storage Lab

The same table can be stored in different ways. Edit a few records, choose which columns to ask for, and see what a simple SELECT query needs to read in row-oriented and column-oriented storage.

1 ยท Create your table

Edit the sample records, or add and remove rows. The table is named employees.

RowidnamedepartmentsalaryActions

2 ยท Write a SELECT query

Supports SELECT * or a comma-separated list of columns from employees, with an optional equality filter such as WHERE department = 'Design' or WHERE salary = 90000. Column names are id, name, department, and salary.

3 ยท Compare the reads

Cells read to answer this queryโ€”

๐Ÿ“„ Row-oriented

Each record is stored together, side by side.

โ€” cell reads

Data read from storage

๐Ÿ“š Column-oriented

Values from the same column are stored together.

โ€” cell reads

Data read from storage

Query result

What counts as a read?

This lab counts individual table cells accessed, not disk pages or bytes. For the row-oriented model, all columns in every row are read to find matching records and return the requested values. For the column-oriented model, an optional filter reads that column for every row, then reads requested columns only for matching rows. A filter column already read is not counted twice. Real database engines use indexes, compression, caching, and storage pages, so their physical I/O can differ.