get_bloat_summary
Analyze PostgreSQL database bloat to identify tables and indexes with wasted space, estimate reclaimable storage, and prioritize maintenance tasks for performance optimization.
Instructions
Get a comprehensive summary of database bloat across tables and indexes.
Note: This tool analyzes only user/client tables and indexes, excluding PostgreSQL system objects (pg_catalog, information_schema, pg_toast). This focuses the analysis on your application's custom objects.
Provides a high-level overview of:
Top bloated tables by wasted space
Top bloated indexes by estimated bloat
Total reclaimable space estimates
Priority maintenance recommendations
Uses pgstattuple_approx for tables (faster) and pgstatindex for B-tree indexes. Requires the pgstattuple extension to be installed.
Best for: Quick assessment of database bloat and maintenance priorities.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema_name | No | Schema to analyze (default: public) | public |
| top_n | No | Number of top bloated objects to show (default: 10) | |
| min_size_gb | No | Minimum object size in GB to include (default: 5) |