get_table_bloat_analysis
Analyze PostgreSQL table bloat using dead tuple and size statistics to identify tables needing VACUUM maintenance and estimate storage waste.
Instructions
[Tool Purpose]: Analyze table bloat based on dead tuple statistics and size information
[Exact Functionality]:
Calculate bloat ratio based on dead tuples vs total tuples
Estimate bloat size in bytes and human-readable format
Show last VACUUM/AUTOVACUUM timestamps for maintenance tracking
Identify tables requiring VACUUM maintenance
Filter tables by name pattern using SQL LIKE or ILIKE matching
Sort results by bloat severity (dead tuple ratio and count)
[Required Use Cases]:
When user requests "table bloat", "bloat analysis", "dead tuples", etc.
When identifying tables that need VACUUM maintenance
When investigating database storage efficiency and space usage
When troubleshooting performance issues related to table bloat
When analyzing specific table groups (e.g., tables with "user", "log", "temp" in names)
[Strictly Prohibited Use Cases]:
Requests for automatic VACUUM execution
Requests for bloat removal or cleanup operations
Requests for table restructuring or data modification
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results to return (1-100, default: 20) | |
| schema_name | No | Schema to analyze (analyzes all user schemas if omitted) | |
| database_name | No | Target database name (uses default database from POSTGRES_DB env var if omitted) | |
| table_pattern | No | Table name pattern to filter (SQL LIKE pattern, e.g., 'user%', '%log%', 'temp_*') | |
| min_dead_tuples | No | Minimum dead tuples to include in results (default: 1, shows all tables with any bloat) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |