How to View Your Postgres Database: psql, GUIs, and VS Code
Want to see what's actually in your app's database? How to look inside Postgres with psql, desktop tools like pgAdmin, DBeaver and TablePlus, VS Code extensions, and your ORM's studio — plus how to connect safely to a database on a server.
Your app saves data somewhere, and at some point you'll want to see it — to check a signup worked, find out why a page is empty, or fix a typo in a record. Here are the ways to look inside a PostgreSQL database, from simplest to most powerful.
First: get your connection details
Every method needs the same information — host, port, database name, user and password — usually found in your app's DATABASE_URL. (Postgres connection strings explained shows how to read one.)
Option 1: psql (the command line)
psql is Postgres's built-in command-line tool. It's always available on servers, and fast once you know a handful of commands.
psql "$DATABASE_URL"
Inside, commands starting with a backslash describe the database:
| Command | Shows |
|---|---|
\l |
All databases |
\dt |
Tables in the current database |
\d users |
Columns, types and indexes of the users table |
\du |
Users (roles) |
\x |
Toggle expanded display (easier for wide rows) |
\q |
Quit |
And any SQL query, ending with a semicolon:
SELECT id, email, created_at FROM users ORDER BY created_at DESC LIMIT 10;
Always add LIMIT when exploring — SELECT * FROM events; on a table with ten million rows will flood your terminal. (SQL for beginners.)
Option 2: A desktop GUI
If you'd rather click than type, a graphical tool shows tables like spreadsheets:
- pgAdmin — the official Postgres admin tool. Free, comprehensive, a bit heavy.
- DBeaver — free and open source, works with almost every database.
- TablePlus, Beekeeper Studio, DataGrip — polished tools with free tiers or paid licences.
You create a new connection, paste in your details (many accept a full connection URL), and browse. Most let you edit cells directly — convenient, and dangerous on a production database (see below).
Option 3: Inside VS Code
Database extensions for VS Code — including an official PostgreSQL extension from Microsoft — let you connect, browse tables and run queries without leaving your editor. Handy if you live in VS Code already. (VS Code for beginners.)
Option 4: Your ORM's studio
If your app uses an ORM, it may come with a browser-based data viewer:
npx prisma studio # Prisma
npx drizzle-kit studio # Drizzle
These show your tables using your app's own models — useful for a quick look. (What is an ORM?)
Option 5: Your host's dashboard
Supabase, Neon and other hosted Postgres providers have a table editor and SQL editor in their web dashboard. The easiest option if your database lives there.
Connecting to a database on a server
Production databases should not be open to the whole internet. Often Postgres only accepts connections from the server it runs on. To reach it from your laptop safely:
SSH tunnel: forward a local port to the database through SSH, then connect your GUI to
localhost:ssh -L 5433:localhost:5432 you@your-server.comNow connect to
localhost:5433on your machine. Most GUI tools also have a built-in "SSH tunnel" option that does this for you. See SSH port forwarding explained.Or run psql on the server after SSHing in.
Avoid opening port 5432 to the internet just to make your GUI work. Bots constantly scan for exposed databases.
Be careful with production data
Looking is safe. Changing is where accidents happen.
Use a read-only user for browsing production, so a stray click can't modify anything:
CREATE ROLE readonly LOGIN PASSWORD '...'; GRANT CONNECT ON DATABASE myapp TO readonly; GRANT USAGE ON SCHEMA public TO readonly; GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;Wrap manual changes in a transaction so you can check before committing:
BEGIN; UPDATE users SET email = 'new@example.com' WHERE id = 42; -- check: should say UPDATE 1 COMMIT; -- or ROLLBACK;An
UPDATEwithout aWHEREchanges every row. (Database transactions explained.)Have a recent backup you've actually tested. (Backups for beginners.)
Never give an AI agent unrestricted write access to production. See how to stop an AI agent from deleting your production database.
The summary
psqlworks everywhere:\dtlists tables,\d tabledescribes one,\qquits.- GUIs (pgAdmin, DBeaver, TablePlus), VS Code extensions and ORM studios are friendlier for browsing.
- Reach server databases through an SSH tunnel, not an exposed port.
- In production: read-only users, transactions for manual changes, and a tested backup.
EasySpawn servers come with PostgreSQL running beside your app and are reachable over SSH, so you can tunnel your favourite database GUI straight to it — or ask Claude Code to query it for you. See how it works or join the waitlist.
Related: SSH Keys Explained · Database Seeding · Postgres Backup and Restore · SQL Joins Explained
Keep reading
What Is an ORM? Prisma, Drizzle, and Friends Explained
An ORM lets you work with your database using your programming language instead of raw SQL. What ORMs are, what Prisma, Drizzle, and others look like, the schema-and-migration workflow, the N+1 trap, and when writing SQL directly is the better choice.
What Is WSL? Running Linux on Windows, Explained
WSL lets you run a real Linux system inside Windows without dual-booting or a separate virtual machine to manage. What it is, why web developers use it, how to install it, where your files live, and the performance and networking gotchas.