The short version
Your Postgres schema is perfectly readable to the database and almost unreadable to a human. The tables, columns, and foreign keys you need are spread across pg_catalog, information_schema, and a few hundred lines of migration SQL. Visualization means collapsing all of that into a picture you can actually reason about.
There are five practical ways to get there. They are not equivalent. Each makes a different trade between speed, depth, and how current the diagram stays.
The five ways at a glance
| Method | Setup | Interactive | Stays current | Best for |
|---|---|---|---|---|
psql + pg_catalog | Zero | No | Always (it's live) | Quick inspection |
| IDE built-ins (pgAdmin, DBeaver) | Already installed | Partly | Snapshot, manual re-run | One-off look |
| Manual diagramming (draw.io, dbdiagram.io) | Short | Yes | Drifts (you maintain it) | Designing a new schema |
| Migrations → DDL (Prisma, Rails) | Medium | No | Re-run on change | Documenting from code |
| Live connection string (dbdiagramr) | None (paste URL) | Yes | Regenerate in 10 seconds | Understanding a real DB |
1. psql and pg_catalog: the baseline
The fastest text-only view is psql. \dt lists all tables, \d table_name shows one table's structure including its foreign keys. To see every relationship in one shot, query information_schema directly:
SELECT tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM information_schema.table_constraints tc
JOIN information_schema.key_column_usage kcu
ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage ccu
ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
AND tc.table_schema = 'public';
Precise and always available. But it's a list, not a picture. Past a dozen tables you're reconstructing the graph in your head, which is exactly what visualization is supposed to remove.
2. IDE built-ins: pgAdmin, DBeaver, DataGrip
If you already have a GUI client, it probably ships with an ER diagram generator:
- pgAdmin 4: right-click the database → ERD For Database. Free, already installed. Auto-layout struggles past a few dozen tables.
- DBeaver (Community is enough): open the ER Diagram tab. Genuinely free, cross-platform, exports PNG/SVG.
- DataGrip: Diagrams → Show Visualization. Best interactive feel; paid, single-user.
The honest limitation they all share: any IDE-based diagram is a snapshot. Nothing to share but an exported image, and it drifts the moment someone runs a migration.
3. Manual diagramming: draw.io, dbdiagram.io, DrawSQL
Great for designing a schema you haven't built yet. dbdiagram.io and DrawSQL are excellent editors — write DBML or drag tables, get a clean diagram.
The catch is drift. The diagram is a hand-made copy at one moment in time. The day someone adds a column or foreign key, the diagram is wrong. A wrong diagram is worse than none, because people trust it. Building it takes 30 minutes to an hour, and it's stale the moment a migration lands. Use these when you're designing. They struggle to document a real schema over time.
4. Generate from your migrations
If your schema lives in migration files (Prisma, Drizzle, Rails, Flyway), derive structure from code instead of a live connection:
pg_dump --schema-only mydb > schema.sql
Then feed the DDL to any SQL-to-diagram tool. This documents the migrations, not necessarily what's actually deployed. Regenerating on every change is automation you have to build and maintain.
5. Paste a live connection string: the "always current in 10 seconds" option
Point a tool at the real database and let it introspect the schema itself. No schema code, no hand-arranging, nothing to keep in sync. The diagram is what's in your database right now.
That's what dbdiagramr does. You paste a PostgreSQL connection string and it queries information_schema for tables, columns, primary keys, and foreign keys, then renders an interactive ER diagram you can pan, zoom, drag, and export as SVG or PNG. Because it introspects the live database, there's no drift — change a migration, paste the same string again, up-to-date in under 10 seconds.
Not sure what an ER diagram looks like yet? The schema library has live diagrams of Supabase, NextAuth.js, Laravel, and Django schemas you can explore before connecting your own database.
Why you should care about "stays current"
Every method above the last one shares the same failure mode: the diagram is a snapshot, and keeping it current is your problem. Walk into any team that's been around a while and you'll find a "schema diagram" in a wiki from eight months ago. A wrong diagram is worse than none — it's confidently wrong.
The test that settles it: how much work does it take to make this picture true again? If the answer is "re-export from my IDE" or "drag the boxes by hand," humans will stop doing it and the diagram will lie to you.
FAQ
What's the easiest way to generate an ER diagram from a Postgres database?
If you have a GUI client open, its built-in diagram is fastest. For a shareable diagram that matches your database as it is right now, a live-introspection tool is fastest because there's nothing to maintain.
Can I create a Postgres ERD without connecting to the live database?
Yes. Run pg_dump --schema-only and feed the DDL to a SQL-to-diagram tool, or parse migration files. Safer when you can't expose production credentials.
How do I keep a schema diagram up to date?
Manual tools require manual regeneration, so they drift. The reliable fix is introspection: regenerate straight from the live database or wire documentation generation into CI.
Does pgAdmin make ER diagrams?
Yes. pgAdmin 4 includes an ERD tool — right-click the database → ERD For Database, or Tools → ERD Tool. Free and built in, best on small-to-medium schemas.
How to choose
- Just want a quick look?
psqlor your IDE's built-in diagram. Fast, local, gone tomorrow. - Designing a new schema? draw.io, dbdiagram.io, or DrawSQL are the right tools.
- Need to understand a database that already exists, or document one that keeps changing? Introspect the live schema.