The short version
An entity-relationship (ER) diagram is a picture of your database structure. Each entity (table) is a box, each attribute (column) is a row inside it, and each relationship (foreign key) is a line between boxes. Cardinality markers tell you whether one row relates to one or many. If you can read those three elements, you can read any ER diagram.
What an ER diagram shows
| Symbol | Meaning | In PostgreSQL |
|---|---|---|
| Box / entity | A table | CREATE TABLE users |
| Rows inside box | Columns + types | id uuid PRIMARY KEY |
| PK badge | Primary key | Unique row identifier |
| FK badge | Foreign key | Reference to another table |
| Line with crow's foot | One-to-many relationship | REFERENCES users(id) |
The three relationship types
One-to-many (1:N) — the most common. One user has many orders. The "many" side holds the foreign key: orders.user_id → users.id. Drawn as a line with a crow's foot (three prongs) on the many end.
Many-to-many (M:N) — via a join table. Users and groups need user_groups(user_id, group_id). Django's auth_user_groups is a classic example. The join table has two foreign keys.
One-to-one (1:1) — rare, usually a vertical split. users and profiles where each user has exactly one profile. Enforced by a UNIQUE on the foreign key.
How to read an ER diagram in 60 seconds
- Find the core entity. Usually
users— most lines point to it. - Follow the FK lines. Each line is a
FOREIGN KEYyou could write as aJOIN. - Check cardinality. Crow's foot = many. No crow's foot = one.
- Look for join tables. Two FKs, often just two columns + PK = M:N.
- Read PKs first. The PK tells you what makes a row unique.
Example: In the Supabase auth diagram, auth.users is the core. Lines radiate to identities and sessions — one user, many identities and many sessions. Each line is a foreign key you can follow with a query.
Why ER diagrams matter for PostgreSQL
PostgreSQL doesn't show you relationships — \d shows one table at a time, information_schema is a wall of text. An ER diagram collapses that into one picture where you can see at a glance: which tables exist, how they connect, where the join tables are, and what you'd need to JOIN to answer a question.
Live-introspected diagrams (like dbdiagramr) guarantee the picture matches production — no drift, no hand-updating. Paste a connection string, get the truth.
FAQ
What is an ER diagram?
A visual map of a database: boxes are tables, rows are columns, lines are foreign key relationships with cardinality (one-to-many, etc.).
What does the crow's foot mean?
It marks the "many" end of a relationship. A line from users to orders with a crow's foot at orders means one user can have many orders.
What's the difference between ER diagram and schema diagram?
They're the same thing in practice. "Schema diagram" emphasizes the PostgreSQL schema; "ER diagram" emphasizes the entity-relationship model. Both show tables, columns, and foreign keys.
How do I make an ER diagram from a PostgreSQL database?
Use pgAdmin's ERD tool for a quick snapshot, or paste your connection string into a live-introspection tool to generate an interactive diagram in 10 seconds.