LAB / 03

Database Index

sequential scan / index lookup

Query a tiny users table twice: once with a sequential scan, once with a sorted index. The rows examined are counted by this simulation, so the contrast is real, not invented.

Conceptual visualizationHow indexing works, described honestly — not a benchmark of PostgreSQL, MySQL or any real engine.

USERS

idnameemailage

Tap a row to query that email. 8/12 rows.

Query

SELECT * FROM users WHERE email = 'user8@example.com'

Rows examined: 0

Press Run query to count what the simulation inspects.

Without an index, finding one email means inspecting rows in order until it matches. With an index, the engine keeps the emails sorted and binary-searches them, so it only compares a handful of entries, then fetches the one row. The numbers shown here are counted by this simulation directly — a conceptual visualization, not a benchmark of PostgreSQL, MySQL or any real engine.