pg_recommendations
Get actionable optimization recommendations for Postgres
Get actionable optimization recommendations for Postgres. Runs analysis and returns only the categorized recommendations with severity, descriptions, and suggested fixes.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
severity | enum | OPTIONAL | all | Filter recommendations by minimum severity: all, critical, warning, info |
Example Request
All Recommendations
Critical Only
Warnings and Above
Response
Recommendation Fields
Each recommendation includes:
| Field | Type | Description |
|---|---|---|
severity | enum | critical, warning, or info |
category | string | Classification (e.g. vacuum, index, configuration, bloat) |
title | string | Brief summary of the issue |
description | string | What the issue is and why it matters |
suggestion | string | Ready-to-run SQL or actionable fix |
reference | string (optional) | Link to relevant documentation |
Error Responses
| Error | Cause | Fix |
|---|---|---|
DATABASE_URL not configured | Missing Postgres connection string | Set DATABASE_URL environment variable |
Recommendations failed | Database connection or query error | Verify DATABASE_URL and database connectivity |
Notes
- This tool is read-only and not destructive — it does not modify your database.
- Requires the
DATABASE_URLenvironment variable to be set (directpgconnection, independent of Supabase). - Use
severityfiltering to focus on the most impactful issues first. - For the full analysis report (table stats, index health, etc.), use
pg_analyzeinstead.
Related Tools
pg_analyze- Full comprehensive health analysispg_report_history- View and compare past reports