# Which database objects no longer earn their keep?

Prompt · Schema and dependencies · PG10

The list of views, functions and triggers has grown hard to reason about.

## Prompt

```text
Examine the tables, views, functions, triggers, indexes and materialized views in this database. Identify redundant representations, obsolete objects, overlapping responsibilities, unnecessary dependency chains and abstractions that no longer provide meaningful value. Verify actual consumers before recommending removal. Rank opportunities by complexity eliminated, operational savings and migration risk.
```

**What it returns:** A map of objects, what depends on them and who uses them, the removal candidates, migration risks and how much complexity goes away.

**Skip it when:** The schema is small and every object has a known reader.

**Avoid:** Deleting objects that look unused but are called dynamically or by outside clients.

**Tools:** Needs: read-only database access to the catalog, plus the repository and any outside clients.

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

- [Layers that don't earn their keep](https://atlasscope.dev/prompts/layers-that-dont-earn-their-keep): Finds extra layers of code you could delete so the code, and the agents reading it, get simpler.
- [Packages nobody uses, or that work by luck](https://atlasscope.dev/prompts/packages-nobody-uses-or-that-work-by-luck): Finds packages nobody uses and packages that work only by accident.
- [Find where write logic should live](https://atlasscope.dev/prompts/find-where-write-logic-should-live): Business rules are split across SQL, triggers, edge functions, server routes and workers.
- [Are we storing the same truth multiple times?](https://atlasscope.dev/prompts/are-we-storing-the-same-truth-multiple-times): Caches, aggregates, materialized views or derived columns drift from the raw facts.
- [Can the schema be easier to understand without losing depth?](https://atlasscope.dev/prompts/can-the-schema-be-easier-to-understand-without-losing-depth): New developers or agents keep misunderstanding names, concepts or relationships.

Source: https://atlasscope.dev/prompts/which-database-objects-no-longer-earn-their-keep
