Sitemap

Before PostgreSQL: Why Do Databases Exist?

3 min readOct 14, 2026

--

Before learning PostgreSQL, let’s start with a simple question:

Why do we need databases at all?

Press enter or click to view image in full size

When we use an app, data is created all the time.

user signs up
product added to cart
payment completed
message sent

All of this data needs to live somewhere.

At first, the easiest answer is: save it in a file.

Starting With a File

Imagine we store users in a file:

1, Alice, alice@example.com
2, Bob, bob@example.com
3, Carol, carol@example.com

If we want Bob, we can read the file and find this line:

2, Bob, bob@example.com

For a tiny app, this works.

Application
|
v
users.txt

But once the app grows, problems appear.

Why Files Are Not Enough

What happens when we have millions of users?

What happens when two people update the file at the same time?

What happens if the computer crashes while writing data?

What happens if we need to find a user quickly by email?

What happens if users have orders, payments, and addresses?

A file can store data.

A database manages data.

File
|
+-- stores data
Database
|
+-- stores data
+-- finds data quickly
+-- updates data safely
+-- handles many users
+-- recovers after crashes

That is the difference.

What a Database Does

A database helps answer important questions:

Where should data live?
How should data be organized?
How do we find data quickly?
How do we update data safely?
What happens if many users use it at once?
What happens if the system crashes?

So a database is not just a place to put data.

It is a system for keeping data useful, safe, and available.

Example: Asking for Data

Suppose we ask:

SELECT name
FROM users
WHERE id = 2;

This query means:

Find the user whose id is 2
and return the name

The result might be:

Bob

From the outside, it looks simple.

SQL Query
|
v
Database
|
v
Result

But inside the database, a lot happens.

Get Deepa Yadav’s stories in your inbox

Join Medium for free to get updates from this writer.

The database has to understand the query, decide how to find the data, read the data, and return the result.

Where PostgreSQL Comes In

PostgreSQL is a database system.

It supports SQL, stores data, handles transactions, uses indexes, manages many users, and can recover after crashes.

PostgreSQL
|
+-- SQL
+-- tables
+-- indexes
+-- transactions
+-- concurrency
+-- recovery

When we write a query like this:

SELECT name
FROM users
WHERE id = 2;

PostgreSQL turns it into internal work.

A simplified version looks like this:

SQL
|
v
Parser
|
v
Planner
|
v
Executor
|
v
Storage
|
v
Result

We do not need to understand all of these parts yet.

For now, the main idea is:

PostgreSQL takes a SQL query and turns it into real work on stored data.

The Big Idea

A small app might survive with a file.

A growing app needs something stronger.

Small app
-> file
Growing app
-> database

Databases help with:

speed
safety
organization
many users
crash recovery

PostgreSQL is one of the best databases to learn because it is powerful, widely used, and open source.

That means we can study not only how to use it, but also how it works inside.

What Comes Next

In this series, I’ll explore PostgreSQL from the inside out.

We’ll start simple and slowly build the full picture.

Next, we’ll ask:

What happens when PostgreSQL starts for the first time?

And later, we’ll follow one query through the system:

SELECT name
FROM users
WHERE id = 2;

Step by step, we’ll move from SQL to the internals behind it.

Further Reading

If you want to build a stronger foundation before going deeper into PostgreSQL, these are good places to start:

--

--

Software developer at Amazon. I write technical blogs about databases, systems, and things I find interesting.