What is a Database, and Why Do We Even Need One?
Data is on disk , so why do we need database? Cause Finding, Managing and securing data is more than just storing it.
What is a Database, and Why Do We Even Need One?
Before we dive into what a database is, let’s first understand why we even need one in the first place.
We use databases to store data permanently — that’s the short answer.
But you might be wondering:
“If the goal is just to store data, can’t we simply use files on disk? Why go through the trouble of using a database?”
That’s a fair question. And the real answer is — storing data is just one part of the problem. Let’s dig deeper.

Files and Databases
Why Not Just Use Files?
Imagine you’re building a simple application and decide to store user or product data in a .txt or .csv file. Initially, that works fine. But as your app grows, you’ll run into real issues.
Let’s walk through a few questions:
- Can you retrieve a specific record in milliseconds?
- What happens when multiple users try to write to the file at the same time?
- Can you easily combine related data from two different files?
- Can you track who changed what, and when?
- Without writing a lot of code, can you filter, sort, or search through the data?
- If the file gets corrupted, can you recover the data?
- Can you efficiently manage terabytes of data using flat files?
If your answer to most of these is “no” or “not easily,” you’re already beginning to see why files alone aren’t enough — especially when building scalable, reliable systems.
But Isn’t Database Data Also Stored on Disk?
Yes — at the end of the day, database data is also stored on disk. But here’s the key difference:
Files store data directly, while databases store data in files using a structured, optimized format.
Think of it like this:
Writing directly to a file is like jotting notes in a diary — useful for yourself, but hard to search through or share efficiently.
A database, on the other hand, is like a digital system that organizes those notes with indexes, categories, and timestamps — making it easy to search, secure, and scale.
So while both end up on disk, databases structure the data using internal files and metadata, enabling features like indexing, concurrency, and replication.
What Does a Database Actually Offer?
Here are just some of the things a modern database provides:
1. Indexing
Databases use indexes to allow fast lookups. Retrieving a record doesn’t require scanning the whole file.
2. Concurrency Control
Databases handle multiple users reading/writing at the same time without corrupting the data.
3. Relationships
You can define relationships between tables — for example, a user and their orders — and run meaningful queries across them.
4. Security & Access Control
Databases support user permissions, audit logging, and encryption to keep your data safe and traceable.
5. Querying
Instead of manually parsing files, you can use a query language like SQL to easily insert, update, or fetch data.
6. Replication
Databases can automatically keep backup copies across servers, ensuring high availability and disaster recovery.
7. Horizontal Scaling
Many databases today support distributing data across machines, so they can handle huge data volumes and traffic.
Summary
Yes, you can store data in files — and for small, simple applications, that might be okay.
But as your app grows and you need more speed, consistency, access control, querying power, and reliability — databases are built exactly for that.
They’re not just about storage — they’re about making your data easy to access, manage, protect, and grow with.
In future blogs, we’ll explore the difference between SQL and NoSQL databases, and when to choose which.
메타데이터
- post_id
- de0cf4a86ae2
- slug
- what-is-a-database-and-why-do-we-even-need-one-de0cf4a86ae2
- url
- https://medium.com/@aishiysan/what-is-a-database-and-why-do-we-even-need-one-de0cf4a86ae2
- canonical_url
- https://medium.com/@aishiysan/what-is-a-database-and-why-do-we-even-need-one-de0cf4a86ae2
- author_url
- https://medium.com/@aishiysan
- status
- ok
- fetched_at
- 2026-06-25 16:53:31