pgbot
An open source command-line tool (Go, Apache 2.0 licence) that examines a PostgreSQL database without ever writing to it: it connects through a monitoring role that has no write grants. In one pass it shows you slow and regressing queries, growing tables, unused or missing indexes, locks, cache hit ratio and vacuum activity, and it even reads the server log over SQL. It can also run as an MCP server, so an agent like Claude Code can query it read-only.
Strengths
- Read-only guaranteed by a role without write grants, not by a promise: nothing to break, even when an agent drives it
- Covers slow queries, table growth, missing or unused indexes, locks and the server log in one go
- Runs with nothing installed through npx, or via Homebrew, Go or Docker, and exposes itself as an MCP server
Limitations
- Still in beta: its output and commands may change from one release to the next
- The read-only guarantee assumes you connect it through the dedicated monitoring role: run it with your admin account and your discipline protects the database, not the tool
Best for
- A founder or PM whose vibecoded Postgres app is slowing down and who wants to know why before paying more
- A dev who wants an agent to diagnose the database without giving it the means to change it