How to Query a PostgreSQL Database in Plain English (Free, 100% Local)
You know the question you want answered. You just don't want to remember the exact JOIN, the window function, or which table the created_at lives on. Here's how to ask PostgreSQL in plain English — and get real SQL and results back — without your data ever leaving your machine.
Most database questions are simple in your head: "How many users signed up last month?", "What are my top 10 products by revenue this quarter?", "Which customers haven't ordered in 90 days?" Turning those into correct SQL is the tedious part — especially against a schema you didn't design or haven't touched in months.
dbclaw is a free, local-first desktop app that does exactly that translation. You type a question, it reads your live schema, writes read-only SQL, runs it, and shows you the table. This guide walks through it end to end with PostgreSQL.
What you'll need
- A Windows 10/11 PC (macOS and Linux are on the roadmap).
- A PostgreSQL database you can connect to — local, a Docker container, or a managed one (RDS, Supabase, Neon, etc.).
- An AI model. You can use a cloud provider with an API key, or run a local model with Ollama so nothing leaves your computer. More on both below.
Step 1 — Install dbclaw
Grab the latest Windows build from the releases page. The *-setup.exe installer is recommended — it's a per-user install, needs no admin rights, and updates itself.
Step 2 — Connect your PostgreSQL database
Open the connection switcher in the top-left and choose Add connection. Pick PostgreSQL and fill in:
| Field | Example |
|---|---|
| Host | localhost or db.example.com |
| Port | 5432 |
| Database | app_production |
| User / Password | your database user (read access is enough) |
SSL modes are supported for managed databases. Click Test to verify, then Save. Your password is stored in your operating system's keychain — never in a plain config file.
Step 3 — Pick an AI model
dbclaw uses a large language model to translate English into SQL. Open Settings → LLM provider and choose one:
- Cloud (needs an API key): Anthropic Claude, OpenAI, Google Gemini, or DeepSeek. Paste a key under Cloud provider keys → Add. Keys go in your OS keychain.
- Local (no key, fully offline): install Ollama, pull a tool-capable model like
llama3.1:8b, and point dbclaw athttp://localhost:11434. With this option, nothing leaves your machine at all — we cover the full setup in this guide on local LLMs.
Step 4 — Ask your first question
Open the Chat tab, select your Postgres connection, and type a question like:
How many users signed up in the last 30 days?
dbclaw reads your schema, writes SQL similar to this, runs it, and shows you the number:
SELECT count(*)
FROM users
WHERE created_at >= now() - interval '30 days';
Because it's a chat, you can keep going without repeating yourself:
Now break that down by signup source, highest first.
It remembers the context and adjusts the query. Try things like:
- "Top 10 customers by total revenue this year, with their email."
- "Which products were ordered the most last quarter but are now out of stock?"
- "Show daily active users for the last 14 days as a table."
Every answer shows the exact SQL it ran, so you can learn from it, copy it, or paste it into your own tooling.
It's read-only and local-first by design
Two things matter when you point an AI at a production database:
- Read-only: dbclaw blocks
INSERT,UPDATE,DELETE,DROPand other writes before anything reaches Postgres. The model literally cannot modify your data. - Local-first: the app runs on your machine. The only thing sent to the AI provider is your question plus the database schema (table and column names) — never your rows. And if you use a local Ollama model, even that stays on your computer.
When a query fails, it fixes itself
Real schemas are messy — a column is named signup_ts instead of created_at, or a table got renamed. When generated SQL errors out, dbclaw re-reads your live schema, corrects the query, and retries — then shows you what it changed. You get the answer instead of a stack trace.
Beyond a single Postgres database
Once you're set up, the same plain-English approach works across everything dbclaw connects to:
- Other databases: MySQL, SQL Server, SQLite, MongoDB (including Atlas), plus CSV, JSON and Excel files.
- Excel export: send any result straight to a native
.xlsxworkbook — the full dataset, not just what's on screen. - Federated queries: join Postgres with, say, MongoDB and a spreadsheet in one question. See cross-database queries.
FAQ
Do I need to know SQL?
No. Ask in plain English. If you do know SQL, there's a Query tab where you can write it yourself (read-only).
Is it really free?
Yes — dbclaw is free to download and use on Windows. If you use a cloud AI provider you pay that provider for tokens; with a local Ollama model there's no cost at all.
Will it touch my data?
No writes, ever. Queries are read-only and your rows never get sent to the AI — only your question and the schema.
Try it on your own database
Free, local-first, read-only. No account needed.
Download dbclaw for Windows