Database Schema Reviewer
Paste a schema and get a review covering normalisation, indexes, constraints, nullability, and the queries that will get slow at scale.
The Prompt — replace [BRACKETS] with your details
Act as a database engineer reviewing a schema before it ships. The schema: ```sql [PASTE CREATE TABLE STATEMENTS OR AN ORM MODEL] ``` Context: - Database: [POSTGRES / MYSQL / SQLITE / OTHER, WITH VERSION IF KNOWN] - What the application does: [DESCRIPTION] - The queries that will run most often: [LIST THEM IN PLAIN LANGUAGE OR SQL] - Expected row counts in a year: [PER TABLE] - Write versus read pattern: [MOSTLY READS / HEAVY WRITES / BURSTY] Review and deliver: 1. Correctness: missing primary keys, wrong types, columns that should not be nullable, missing foreign keys, absent unique constraints. Give the ALTER statement for each 2. Data integrity rules that are currently only enforced in application code and should be constraints in the database 3. Indexes: which to add for my stated queries, with the column order and the reason; which existing ones are redundant or unused; the write cost of each addition 4. Normalisation: where denormalising is justified for my read pattern, and where the current design will cause update anomalies 5. The three queries most likely to become slow at my projected row counts, and what to change now 6. Time and timezone handling, money and precision handling, and soft-delete or audit columns if my domain needs them 7. The migration order to apply all this safely on a live table, flagging anything that takes a lock Rank everything as: fix before shipping, fix soon, or optional.
How to use this prompt
- List your real queries — index advice without query patterns is generic and often wrong.
- Apply the "fix before shipping" items first; constraints are far cheaper to add before there is bad data than after.
- Test the migration order on a copy with realistic row counts, especially anything that locks a table.
Why this prompt works
Schema problems are cheap now and expensive later, and the expensive ones are predictable: missing constraints, wrong nullability, and indexes chosen without knowing the queries. Requiring the projected row counts and query list gives the model the two inputs that turn generic advice into specific advice.
Variations to try
- Ask for the equivalent review of your ORM models with the migration files it would generate.
- Add "we need to support multi-tenancy" for a review of isolation and index prefixes.
- Paste a slow EXPLAIN plan and ask which schema change would fix it.
Common mistakes to avoid
- Adding every suggested index. Indexes cost write throughput and storage, and unused ones are pure cost.
- Storing money as a float, which produces rounding errors you will find during an audit.
- Running a locking migration on a large production table during business hours.
Works well with
Need a custom version of this prompt?
The free prompt generator builds a prompt tailored to your exact goal, framework, and target AI model — or paste this template into the optimizer to refine it.
Related prompts
Code Review Assistant
Paste code and get a structured review covering bugs, readability, performance, and securi…Debug Any Error Message
Paste an error message and the related code to get the likely root cause, a fix, and how t…Unit Test Generator
Generate thorough unit tests for any function, covering happy paths, edge cases, and failu…Code Documentation Writer
Generate clear docstrings, inline comments where needed, and a README-style usage section …Sponsored
Revenue Signal
Visitor → payment → MRR
MRR
$9.4k
+18%
ARR
$112k
run rate
Net New
+$1.7k
this month
Subs
192
active
ARPU
$49
per account
Churn
3.2%
watchlist
new MRR
+$1.9k
expansion
+$620
reactivation
+$210
churn + contraction
-$790
Failed Payments
$820 at risk
Open Metrics
public page ready
Click-worthy signal
Turn the traffic your content earns into real revenue — see which visitors actually convert.
Find my MRR signal →