DEV Community

Discussion on: Explain Indexing Like I'm Five

Collapse
sam_ferree profile image
Sam Ferree

You couldn't actually use this on a five year old today, because it requires understanding what phonebook is, but...

The yellow pages lists people by name in alphabetical order. It is indexed by last name. Searching for a number by last name is very fast. Searching for a last name by number is very slow, and could potentially require you to look at the entire book.

The white pages list businesses by sector. It is indexed by sector. Searching for a business by sector is very fast. Searching for a business by phone number is very slow, and could potentially require you to look at the entire book.