Skip to main content

Claude Prompt for Normalization & Denormalization Decisions

Analyze your database design for when to normalize vs denormalize, with trade-off tables, migration paths, and performance comparisons.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt turns the model into a database architect that audits your schema and advises on where to normalize and where to strategically denormalize. You provide your [current_schema] plus application context — [app_type], [access_patterns], [scale_info], and [consistency_needs] — and it evaluates the design against normal forms, flags anomalies, and recommends targeted denormalizations with migration paths.

The structure keeps it honest. It checks 1NF through BCNF and, for each violation, names the specific insert, update, or delete anomaly it can cause. Then it evaluates denormalization patterns (computed columns, redundant columns, summary tables, JSON columns, materialized views) in a trade-off table, gated by a decision tree that weighs your read/write ratio and [consistency_needs]. Because you supply [access_patterns] and [scale_info], it can tell you when a JOIN is worth removing and when consistency should win. The [additional_pattern] slot lets you pose a specific question, like whether polymorphic relationships belong in shared or per-type tables.

When to use it

  • When a data model has grown messy and you need to decide where denormalization actually pays off.
  • To audit a schema against normal forms and find anomalies before they corrupt data.
  • When JOINs are causing measurable latency and you're weighing a redundant column or summary table.
  • Before scaling a read-heavy product where pre-aggregation or materialized views might help.
  • To get concrete, reversible migration steps instead of a risky one-shot schema change.

Example output

You get a normalization audit (1NF/2NF/3NF/BCNF) with each violation, the anomaly it causes, and the ALTER/CREATE statements to fix it. Then a denormalization table with columns for the change, why, the trade-off, and when-to-use vs. when-not-to. It includes a decision framework, a five-step backward-compatible migration path with actual SQL, a before/after performance comparison on the top changes, and monitoring queries to detect staleness and consistency drift in denormalized data.

Pro tips

  • Paste the full [current_schema] including constraints and keys so the BCNF check can spot non-trivial functional dependencies.
  • Be specific in [consistency_needs]: mark which tables must be strongly consistent (payments, orders) and which can tolerate staleness, so it never denormalizes the wrong data.
  • Describe [access_patterns] by read vs. write intensity per area — the decision tree leans on the 10x-read heuristic to recommend denormalization.
  • Measure JOIN latency yourself before acting. I make the model insist on benchmarks because denormalization is a bet, not a default.
  • Use [additional_pattern] to ask about a real modeling dilemma you're stuck on, like polymorphic comments or tags.
  • Run the generated migration in stages (add, backfill, switch, verify, drop) and keep the validation period before removing old structures.

Frequently Asked Questions

Does this prompt check all normal forms?
Yes, it evaluates the schema against 1NF, 2NF, 3NF, and BCNF. For each violation it explains the specific insert, update, or delete anomaly it can cause and gives ALTER or CREATE TABLE statements to fix it.
How does it decide when to denormalize?
It applies a decision tree weighing your read-to-write ratio, whether consistency is critical, whether JOINs cause measurable latency, and team size. You supply `[consistency_needs]` and `[access_patterns]` so it can apply the tree to your situation.
Will it give me actual migration SQL?
Yes. For each recommended change it outlines a five-step, backward-compatible migration (add, backfill, update code, verify, remove) and includes the SQL migration scripts rather than just describing the steps abstractly.
Can it handle polymorphic relationships?
Yes, if you raise it. The `[additional_pattern]` variable defaults to asking whether polymorphic comments, tags, and addresses should use per-type tables or a shared table, and you can swap in your own modeling question.
Does it protect financial data from over-denormalization?
It does when you tell it. Mark order and payment tables as strongly consistent in `[consistency_needs]`, and the decision tree keeps that data normalized instead of trading consistency for read speed.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Data & SQL Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support