Module F-1·19 min read

The problem databases solve, the client-server model, installation, and your first database — zero prior knowledge assumed.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

F-1 — What Is PostgreSQL and Why Does It Exist?

Who this module is for: You have never used PostgreSQL before, or you have used it briefly but never understood what it actually is under the hood. You might be a bootcamp graduate, a frontend engineer expanding into backend work, or a developer who has only ever used MongoDB or Firebase. This module assumes nothing. By the end, you will have a working PostgreSQL installation, a mental model of how it operates, and your first real database.


The Problem Databases Solve

Before talking about PostgreSQL specifically, it helps to understand the problem it solves.

Imagine you are building a to-do app. You store your tasks in a JavaScript array:

javascript

This works while the application is running. The moment it stops — the server restarts, the user closes the tab, the process crashes — that array disappears. Everything is gone.

The first problem databases solve: persistence. Data that outlives the program that created it.

Now imagine your app has 100,000 users. You could store all their tasks in a single file, but:

  • Reading one user's tasks means reading the entire file
  • Two users saving at the same moment could corrupt the file
  • Searching for all overdue tasks means scanning every single record

The second problem databases solve: efficient access at scale. Finding, filtering, and sorting millions of records quickly without reading everything.

Now imagine your team has five engineers, and three of them are updating user data simultaneously from different services. One engineer reads a user's balance as $500, another reads it as $500 at the same moment, and they both try to debit $300. The user ends up $100 short because neither knew the other was also writing.

The third problem databases solve: concurrent access without corruption. Multiple readers and writers operating simultaneously without stepping on each other.

PostgreSQL solves all three of these problems. It is a database management system — a piece of software that stores your data durably, retrieves it efficiently, and manages concurrent access safely.


Why PostgreSQL Specifically?

There are many database systems. Here is the honest comparison for someone just starting:

SQLite — a database that lives in a single file. Perfect for mobile apps, local development, or small embedded applications. Not designed for multiple users or high traffic. This is often what tutorials use because it requires zero setup.

MySQL / MariaDB — PostgreSQL's closest competitor. Both are production-grade relational databases. MySQL has a longer history in web development (it powered most early PHP applications). PostgreSQL has historically been more standards-compliant and feature-rich. In practice, both are excellent choices.

MongoDB — a document database. Instead of rows and columns, it stores JSON-like documents. Flexible, but trades the ability to do complex queries and guarantee data consistency for that flexibility. Many engineers start with MongoDB because it feels more like JavaScript objects, then discover PostgreSQL later.

PostgreSQL — what this course teaches. Open-source, free, battle-tested at petabyte scale, and the database that serious backend engineers tend to gravitate toward because of its combination of reliability, features, and performance.

The practical answer for 2025: if you are building a backend application and don't have a strong reason to use something else, use PostgreSQL. It handles everything from a side project with 10 users to production systems with billions of rows.


The Client-Server Model

PostgreSQL operates as a server. It runs as a separate process on your machine (or a remote machine), listening for connections on a port (default: 5432).

Your application — or psql, the command-line tool — is the client. It connects to the PostgreSQL server, sends queries, and receives results.

text

This separation matters because:

  • The database server handles all the hard work: storing data on disk, managing memory, handling concurrent requests
  • Your application only needs to send SQL and handle results
  • Multiple applications can connect to the same database server simultaneously

When you deploy a real application, the database server typically runs on a separate machine from your application server. They communicate over a network. This is why "connecting to the database" involves a host, port, username, and password.


Installing PostgreSQL

bash

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.