Agentsql

Natural Language to SQL for Postgres: Chat With Your Postgres Database

Point Agentsql at your Postgres database with a read-only role, ask a question the way you would ask a teammate, and get the query, the chart, and the answer together.

See pricing

Read-only by design · shows the SQL every time · never trains on your data

Connected · demo_shop · Postgres · read‑only

Ask your data a question:

›_

Writing SQL… Running (read‑only)… SQL Agentsql wrote

Refine: refined ✓

Click a question. Agentsql writes the SQL, runs it read-only, and answers.

Direct answer

Natural language to SQL for Postgres means typing a question in plain English and having a tool write the Postgres query for you, run it, and return the result. Agentsql connects to your Postgres database with a read-only role, generates SQL against your real schema, runs it, and returns a chart, a table, and a one-line answer. The exact query is shown every time, so you can read it, verify the joins, and reuse it.

Why teams do this

Postgres is where most product data actually lives, which is why so many business questions die in a ticket queue. The people who need the number (a founder, an ops lead, a PM) rarely write SQL, and the engineer who can write it is mid-sprint. Agentsql removes that handoff. It reads your schema, writes the query, runs it read-only, and gives back an answer the asker can act on, with the SQL on screen so the engineer can sanity-check it in five seconds instead of writing it from scratch.

What you get back

  • The SQL. The exact PostgreSQL query Agentsql wrote, on screen, every time.
  • The result. A table of rows straight from your database, not a summary of a summary.
  • The chart. The right visual for the shape of the answer.
  • The answer. One plain-English line you can paste into Slack and defend.

›_ connect it safely

Connect PostgreSQL read-only.

The right way to connect any AI analyst to Postgres is a dedicated read-only role, scoped to the schemas it should see and nothing else. It takes a couple of minutes:

  1. 1

    Create a dedicated login role for the tool, separate from your application user.

  2. 2

    Grant CONNECT on the database and USAGE on only the schemas it should read.

  3. 3

    Grant SELECT on the tables it needs, and nothing else. No INSERT, UPDATE, DELETE, or DDL.

  4. 4

    Set default privileges so new tables in that schema stay readable without re-granting.

  5. 5

    Optionally set a statement_timeout on the role so an exploratory query can never run away.

  6. 6

    Paste the connection string into Agentsql. It connects over TLS and only ever issues read queries.

The boundary is enforced by your database, not by our promise. Read more about how Agentsql stays read-only by design, or how it connects to your database.

›_ ask it anything

Questions you can ask Postgres in plain English.

Type the question the way you would ask a teammate. Agentsql writes the PostgreSQL query, runs it read-only, and shows you both the SQL and the answer.

Plain-English question What the SQL does
How many signups converted to paid last month? Joins users to subscriptions, filters on the paid transition date.
Which customers have not placed an order in 90 days? Anti-join against orders with a date window, the classic churn-risk pull.
What is our monthly recurring revenue by plan? Groups active subscriptions by plan and sums the recurring amount.
Show weekly active users for the last 12 weeks. Buckets events by week with date_trunc and counts distinct users.
Which referral sources produced the most paying customers? Attribution join from signups to first payment, grouped by source.

›_ the honest comparison

Four ways to answer a Postgres question.

Every option below is legitimate. The right one depends on who is asking and how fast they need the number.

Approach Who can use it Time to an answer The SQL Safety note
Write the SQL yourself in psql or a client Engineers and analysts Minutes to hours per question You write it Depends on the credentials you use
Ask an engineer and wait Everyone else Hours to days Someone else writes it Low, but it burns engineering time
Paste your schema into a chatbot Anyone Fast draft, then manual work You still run it yourself Schema leaves your control, nothing is verified
Agentsql connected read-only Anyone on the team Seconds Written, run, and shown to you Read-only role, no writes possible

›_ frequently asked

Postgres questions, answered.

How do I query a Postgres database without SQL?

Connect a natural-language tool to Postgres with a read-only role and type your question in plain English. Agentsql reads your schema, writes the Postgres SQL, runs it read-only, and returns a chart, a table, and a written answer. You never open a SQL client, but you can still see and copy the exact query it ran.

Can AI write Postgres queries?

Yes. Modern models write correct Postgres SQL reliably when they are grounded in your real schema rather than guessing at table names. Accuracy comes from schema awareness, clear column naming, and showing the query back to you. Agentsql generates the query against your live schema and displays it with every answer so you can verify the joins and filters.

Is it safe to connect an AI tool to my Postgres database?

It is safe when the connection is read-only and least-privilege. Create a dedicated role with SELECT on only the schemas the tool should see, no write or DDL grants, and connect over TLS. Agentsql is read-only by design, so even a badly worded question cannot change or delete a row.

Does it work on a production Postgres database?

Yes, and most teams connect either a read replica or production with a read-only role. A replica keeps analytical queries off your primary. If you point it at production, set a statement timeout on the role so no exploratory query can hold resources longer than you want.

Will it see my schema, and does it train on my data?

Agentsql reads your schema so it can write correct queries against your real tables and columns. Your data is never used to train models. Queries run read-only against your database and the results come back to you, with the SQL shown so nothing about the answer is a black box.

›_ other databases

Ask Postgres your first question.

Connect read-only in minutes. Every answer arrives with the SQL that produced it.