Skip to main content
Postgres

Features

  • Monitor slow queries and suggest optimizations
  • Detect missing and unused indexes
  • Open PRs with migration scripts
  • MCP server for read-only database access during tasks

Installation

1

Create user (optional)

Create a dedicated read-only database user for Tembo:
CREATE USER tembo_monitor WITH PASSWORD 'your-secure-password';
GRANT CONNECT ON DATABASE your_database TO tembo_monitor;
GRANT USAGE ON SCHEMA public TO tembo_monitor;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO tembo_monitor;
2

Connect

Go to Integrations and click Connect next to Postgres. Enter your connection string.
3

Map repository

Map your database to the repository where migrations are stored so Tembo can open optimization PRs.

Usage

Tembo monitors your database using pg_stat_statements. When it finds slow queries or missing indexes, it opens a PR with migration scripts and expected improvement metrics. Requires pg_stat_statements extension: CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

Advanced

The Postgres MCP runs in read-only mode. It may access your database during tasks when querying would help complete the work.
Use read-only access. Connect production databases for accurate insights. Always review migration PRs before merging, especially for large tables.