Review Glossary FR

Size

Eyes

Finish a part in any dojo to unlock the next eyes.

Day 1 10 min

Why use a database instead of a file

1 / 10 · ≈ 9 min left

The problem

Your side project keeps its data in tasks.json. Load the file, change the list, write the file back. It works for months.

Then the laptop dies halfway through a save. Or two browser tabs save at the same moment, and one tab's changes vanish without an error. Or someone asks for "every task due this week", and the only way to answer is to read the whole file and loop.

You could write a fix for each of these three problems yourself. A database already ships all three fixes. And sometimes the right database is still a single file: SQLite's own docs say it "does not compete with client/server databases. SQLite competes with fopen()."