pg_analyze
Run a comprehensive Postgres health analysis
Run a comprehensive Postgres health analysis. Returns table stats, index health, vacuum status, connection info, bloat estimates, Textrawl-specific checks, and actionable recommendations. Optionally saves the report for trend tracking.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
save | boolean | OPTIONAL | false | Save report to history for future comparison |
Example Request
Quick Health Check
Analyze and Save Report
Response
When save is true, the report is persisted to PG_REPORT_DIR (default ./reports/pg-analysis) for future trend comparison via pg_report_history.
Error Responses
| Error | Cause | Fix |
|---|---|---|
DATABASE_URL not configured | Missing Postgres connection string | Set DATABASE_URL environment variable |
Analysis failed | Database connection or query error | Verify DATABASE_URL and database connectivity |
Notes
- This tool is read-only and not destructive — it only reads database statistics and metadata.
- Requires the
DATABASE_URLenvironment variable to be set (directpgconnection, independent of Supabase). - The analysis covers:
- Table stats: row counts, sizes, growth
- Index health: unused indexes, duplicate indexes, missing indexes
- Vacuum status: dead tuples, last vacuum/analyze times
- Connection info: active connections, idle connections
- Bloat estimates: table and index bloat
- Textrawl-specific checks: embedding dimensions, RLS policies, function health
- Recommendations: actionable suggestions with severity levels
Related Tools
pg_recommendations- Get only the optimization recommendationspg_report_history- View and compare past reports