Bugsy
Explains
3 hearts left

Indexes

New idea

Finding one email among a million

You log in and the site runs SELECT * FROM users WHERE email = 'sara@example.com';. The table has 1,000,000 rows. How does the database find Sara?

On its own, it checks every row, one by one, from the first to the last. That is a full table scan, like hunting for one word in a book by reading every page.

It can't even stop when it finds Sara: nothing promises there isn't a second row with the same email further down.