Part 01 / Topic 3 of 10
How PostgreSQL is organised
PostgreSQL runs as a server in the background. You don't open it like an app — it sits there listening (normally on port 5432), and client tools like psql connect to it. That client–server design is exactly what lets many apps and users share one database at the same time.
Inside the server, things nest in a fixed hierarchy:
PostgreSQL server (one "cluster", one port)
└── databases shopdb, postgres, template1, ...
└── schemas public by default
└── tables customers, orders, products, ...
(and views, indexes, functions, ...)
- A server (the docs call a running instance a cluster) hosts many databases, each a separate world — connecting to one shows you nothing of the others.
- A schema is a named drawer inside a database. Everything you create lands in the default schema
publicuntil you say otherwise, which is why psql shows your tables aspublic.customers. One drawer is fine for this whole course; schemas get their moment in Stage 3. - Tables (plus views, indexes and functions) live inside schemas.
A fresh install has a postgres database — your default landing spot — and two template databases that Postgres copies when creating new ones. Leave the templates alone.
🧪 Quick quiz — answer from memory, then check.
- In PostgreSQL, what sits directly inside a database and holds tables?
- Which port does PostgreSQL normally listen on?
Show the answers
- A schema — the default one is
public. (The server holds databases, each database holds schemas, and the schemas hold the tables.)
Done here? The practice set for Part 1 — 6 exercises with solutions — is on the part page.