SQL Sequential Scan
Read every row, check each one against the filter — simple, and often the right choice.
What & Why
A sequential scan (Seq Scan) reads a table from start to finish, checking every row against the query's conditions. No index is consulted — this is the fallback every table always supports.
See How It Works
BUSINESS QUESTION
Growth reviews all active users, a broad population that may reasonably use a sequential scan.
| id | created_at | country | channel | plan | activated_at | churned_at |
|---|---|---|---|---|---|---|
| 101 | 2024-01-15 09:10:00+00 | US | organic | pro | 2024-01-16 14:25:00+00 | NULL |
| 102 | 2024-02-10 11:05:00+00 | CA | paid | free | NULL | 2024-03-20 10:00:00+00 |
| 103 | 2024-03-12 16:35:00+00 | GB | referral | pro | 2024-03-13 08:15:00+00 | NULL |
| 104 | 2024-04-01 13:20:00+00 | US | organic | free | 2024-04-03 12:00:00+00 | NULL |
EXAMPLE QUERY
SELECT
id,
channel,
plan,
created_at
FROM growth.users
WHERE churned_at IS NULL
ORDER BY id;RESULT — active user rows
| id | channel | plan | created_at |
|---|---|---|---|
| 101 | organic | pro | 2024-01-15 09:10:00+00 |
| 103 | referral | pro | 2024-03-12 16:35:00+00 |
| 104 | organic | free | 2024-04-01 13:20:00+00 |
The SELECT result is deterministic; whether PostgreSQL chooses a sequential scan depends on live table statistics.
This lesson's practice is part of Pro.
Sign up free to try it on a real business scenario