> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tembo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Postgres

> Performance monitoring, slow query detection, and optimization.

![Postgres](https://mintcdn.com/test-8862363a/_KF7n4fDwDrxMgZe/images/integrations/postgres.png?fit=max\&auto=format\&n=_KF7n4fDwDrxMgZe\&q=85\&s=c5d0e684b53ff97275113750ab6e551a)

## 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 sessions

## Installation

**1. Add your connection string**

Go to [Integrations](https://app.tembo.io/integrations) and click **Connect** next to Postgres, then enter your database connection string.

## Usage

After connecting, Tembo can use Postgres tools to run queries against your database during sessions.

Tembo also 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

> [accordion] MCP server
>
> The Postgres MCP can access your database during sessions when querying would help complete the work.

> [accordion] Best practices
>
> You only need to provide a valid connection string. Always review migration PRs before merging, especially for large tables.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.