Prompt·Performance and maintenance·PG13

Find the true sources of database waste

The bill is high, CPU or disk usage is high, storage keeps growing, or you suspect bloat.

Markdown
Prompt
Measure which tables, indexes, queries and maintenance activities consume the most storage, execution time and write resources. Distinguish useful capacity from avoidable waste, including unused indexes, row churn, bloat, poor plans and excessive scans. Recommend changes based on observed workload and realistic savings, not generic optimization rules.
What it returns
Table and index sizes, the top statements, usage counts, dead-row and maintenance figures, EXPLAIN output and the savings you expect.
Skip it when
Usage and cost are small and steady.
Avoid
Judging an index from a code search alone, or looking only at query time and ignoring write cost.
Changes
Changes nothing
Sessions
Look first, then fix in a new session
Tools
Needs: read-only database access and query statistics (pg_stat_statements). Helps: Supabase Advisors, and HypoPG to test an index without building it.
Works on
Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.

Related prompts

More in Performance and maintenance.