# PostgreSQL

> Run, configure and use PostgreSQL, a powerful open source relational database and our default pick. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/backend/postgresql
Last updated: 2026-11-28

Run, configure and use PostgreSQL, a powerful open source relational database and our default pick.

Beginner · about 10 hours · difficulty 2/5

Learn first: [Writing SQL Queries](https://www.internhack.in/roadmaps/tracks/backend/sql-querying)

**PostgreSQL** is our recommended relational database. It is open source, standards-compliant, extremely reliable and has features that let one database cover many needs: JSONB columns, full-text search, arrays, geospatial data (PostGIS), and extensions such as `pgvector` for embeddings.

### What to learn

- Install it locally (or run it in Docker) and use `psql`: `\l`, `\c`, `\dt`, `\d table`.
- Roles and permissions: create an application user that owns only its database, never connect your app as the superuser.
- Data types worth knowing: `text`, `integer`/`bigint`, `numeric` for money, `timestamptz` for time, `uuid`, `jsonb`, `boolean`.
- Connection strings, SSL mode and how your driver connects.
- Backups with `pg_dump` and restoring with `pg_restore`, and why managed services (RDS, Cloud SQL, Neon, Supabase) are popular.

### Why PostgreSQL

It handles workloads from a hobby app to large production systems, and skills transfer directly to managed Postgres offerings everywhere.

### Pitfalls

- Using `timestamp` without time zone and then fighting time zone bugs. Prefer `timestamptz`.
- Using floating point for money.
- Never testing restores. A backup you have not restored is a hope, not a backup.

You are ready to move on when you can create a database and app role, load a schema, take a dump and restore it into a fresh instance.

## Key concepts

- **psql command-line client**
- **Roles and privileges**
- **Data types: timestamptz, numeric, jsonb**
- **pg_dump and pg_restore**
- **Extensions (PostGIS, pgvector)**
- **Managed Postgres services**
- **Full-text search in Postgres**

## Other options for this step

- [MySQL, SQLite and Other Engines](https://www.internhack.in/roadmaps/tracks/backend/other-relational-engines): Know the other common relational engines and how they differ from PostgreSQL, in case your job uses one.

## Mini project

Run PostgreSQL in Docker, create an app role with limited privileges, load your library schema, and script a nightly pg_dump that you verify by restoring into a second container.

## Check yourself

Why should your application not connect to PostgreSQL as the postgres superuser?

## Free resources

- [PostgreSQL documentation](https://www.postgresql.org/docs/) (PostgreSQL)
- [PostgreSQL Tutorial](https://www.postgresqltutorial.com/) (postgresqltutorial.com)

Previous: [Writing SQL Queries](https://www.internhack.in/roadmaps/tracks/backend/sql-querying) · Next: [MySQL, SQLite and Other Engines](https://www.internhack.in/roadmaps/tracks/backend/other-relational-engines)

## More in Storing Data Relationally

- [The Relational Model](https://www.internhack.in/roadmaps/tracks/backend/relational-model)
- [Writing SQL Queries](https://www.internhack.in/roadmaps/tracks/backend/sql-querying)
- [PostgreSQL](https://www.internhack.in/roadmaps/tracks/backend/postgresql)
- [MySQL, SQLite and Other Engines](https://www.internhack.in/roadmaps/tracks/backend/other-relational-engines)
- [Schema Design and Normalization](https://www.internhack.in/roadmaps/tracks/backend/schema-design-normalization)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
