Prompt·Schema and dependencies·PG11
Are we storing the same truth multiple times?
Caches, aggregates, materialized views or derived columns drift from the raw facts.
Prompt
Find concepts and values maintained in multiple tables, materialized views, caches or derived columns. Trace which representation is authoritative, why each copy exists, how it stays synchronized, and what happens when the copies disagree. Recommend which duplication is justified by performance or history and which should be removed.
- What it returns
- The authoritative source and each copy, how each is refreshed, examples of drift, and what each copy costs readers and writers.
- Skip it when
- Each fact is stored once.
- Avoid
- Rejecting all denormalisation. Copies kept for speed or history can be worth it.
- Changes
- Changes nothing
- Sessions
- Look first, then fix in a new session
- Tools
- Repository and read-only database access.
- Works on
- Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.
Related prompts
- Two systems that disagreePromptFinds data kept in two places (a saved copy and a table, the browser and the server) that can quietly disagree.
- Where did this number come from?PromptChecks that every number on screen can be traced back to a source document.
- Map every place that writes to the databasePromptSeveral jobs, functions, APIs or agents change the same data, or nobody is sure who owns it.
- Which database objects no longer earn their keep?PromptThe list of views, functions and triggers has grown hard to reason about.
More in Schema and dependencies.