Prompt·Schema and dependencies·PG10

Which database objects no longer earn their keep?

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

Markdown
Prompt
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.
Changes
Changes nothing
Sessions
Look first, then fix in a new session
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.

Related prompts

More in Schema and dependencies.