A terminal UI for PostgreSQL with multi-LLM AI assistant, explain plans, index suggestions, and a keyboard-driven interface — all powered by pgx.
Built from scratch with Go and pgx — no psql dependency required.
Chat with OpenAI, Anthropic, Gemini, or local Ollama models — directly inside the terminal. Ask questions, generate SQL, and get optimization tips.
SQL editor, Explain plan, Index suggestions, Database statistics, Activity log, and AI chat — each in a dedicated tab, switchable with a keypress.
Connects directly to PostgreSQL via the Go pgx driver. No psql binary needed, no shell dependency — just a pure Go connection.
Built-in local port forwarding for remote databases behind firewalls. Configure host, port, key, and passphrase right in the TUI.
Tab switching, command mode, jump mode, help overlay — navigate everything without reaching for the mouse. Vim-style and psql-style commands.
Database queries and AI operations run asynchronously and never block the UI. Keep browsing while your query executes.
Switch between views with Tab or number keys. Every view is purpose-built.
Write and execute queries with \dt, \di, \dv, \d <table> meta-commands. Results render in a beautifully formatted table.
\setVisualize query execution plans with EXPLAIN ANALYZE output. Spot sequential scans, index scans, and cost estimates at a glance.
Get AI-powered suggestions for creating indexes to optimize your queries. Understand which columns to index and why.
Monitor your PostgreSQL instance with real-time statistics — table sizes, index usage, cache hit ratios, and more.
Tail your query activity in real time. See every query executed, its timing, and any errors — all in a live-scrolling log.
Chat with your choice of LLM directly in the terminal. Ask it to explain queries, suggest optimizations, or generate SQL for you.
Install with Go or download a pre-built binary for your platform.
go installThe easiest way if you have Go installed.
Grab a release from GitHub for your platform.
Swap providers with one config change. Cloud or local — your call.
GPT-4o, GPT-4o-mini
Claude Sonnet, Opus
Gemini 2.0 Flash, Pro
Llama 3.2, CodeLlama
Local · FreeGoogle OAuth login
FreeEvery action is a keypress away. No mouse required.
Install paiSQL in seconds and start querying with AI by your side.