Why not just a file?
Four problems that appear the second a second user shows up.
Storing data in a file works perfectly until the moment two things touch it at once. Everything a database gives you is a solution to a problem that only exists when there is more than one of something: more than one user, more than one server, more than one write in flight.
- Concurrency
Two writes at the same instant do not corrupt each other. - Durability
A confirmed write survives the power going out. - Query speed
Find one row among ten million without reading ten million. - Integrity
Rules the data cannot violate, no matter which code path is buggy.
The fourth item, integrity, is the one people skip and later regret. A rule like "an order must belong to a customer that exists" enforced by the database is true forever. The same rule enforced only in your code is true until someone writes a second code path, or an admin script, or an AI-generated migration.
What to remember
- Databases solve problems caused by simultaneity, not by size.
- Rules enforced by the database survive your future bugs.
- Multi-step changes need transactions or they can half-happen.
Terms in this lesson
Show field notes toggles a search param the loader reads. With it off, the slow promise is never created, so nothing streams.