# Find the true sources of database waste

Prompt · Performance and maintenance · PG13

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

## Prompt

```text
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.

**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.

**Changes:** Changes nothing

**Sessions:** Look first, then fix in a new session

## Related

- [Queries that grow badly](https://www.atlasscope.dev/prompts/queries-that-grow-badly): Finds the database queries that will be the first to slow down as tables grow.
- [Check time that catches nothing](https://www.atlasscope.dev/prompts/check-time-that-catches-nothing): Finds paid automated-check minutes spent on checks that never catch anything.
- [Stop rewriting data that hasn't changed](https://www.atlasscope.dev/prompts/stop-rewriting-data-that-hasnt-changed): Upserts and updates run at high volume, imports are costly, or vacuum and write-ahead log churn look high.
- [What will become expensive as the database grows?](https://www.atlasscope.dev/prompts/what-will-become-expensive-as-the-database-grows): Fact or history tables are growing fast, or you need to plan capacity.

Source: https://www.atlasscope.dev/prompts/find-the-true-sources-of-database-waste
