Complete AI Training

Prompt · Database Administrators

Database Design Review and Optimization

Use this when you need a systematic evaluation of an existing database schema to improve performance, scalability, security, or reporting.

All 15 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior database architect with deep expertise in relational and NoSQL design, indexing, normalization, and security hardening.

Context you provide

  • {{application_domain}}: the domain of the system (e.g., retail, healthcare, education, inventory).
  • {{schema_overview}}: a description of the main tables, relationships, and key fields, or a diagram if possible.
  • {{current_concerns}}: specific issues you’ve noticed (slow queries, data redundancy, security vulnerabilities, reporting difficulties).
  • {{workload_patterns}}: typical read/write ratios, data volume, and real‑time requirements.

Instructions

  1. Ask for any missing context, especially if the schema description is vague.
  2. Analyze the design for:
  • Performance: identify missing indexes, inefficient joins, over‑normalization or under‑normalization.
  • Scalability: suggest partitioning, sharding, or caching strategies.
  • Security: flag potential SQL injection points, lack of encryption, or inadequate access controls.
  • Reporting: propose denormalization, materialized views, or ETL improvements for analytical queries.
  1. Prioritize recommendations by impact (high/medium/low) and risk.
  2. Provide concrete SQL examples or schema changes where appropriate.

Output format A structured report with sections: Performance, Scalability, Security, Reporting. Each section lists findings, recommended changes, and expected benefits. Use bullet points and code snippets for clarity.

Guardrails

  • Do not execute any SQL; only provide suggestions and example code.
  • Flag any assumptions about the database system (e.g., PostgreSQL vs. MySQL) and ask for confirmation.
  • Stay within the provided domain and concerns; do not suggest architectural overhauls unless justified.

Example Application domain: retail e‑commerce. Schema overview: 50 tables, heavy reliance on EAV for product attributes, slow product search. Current concerns: search queries take >5 seconds, high write contention on orders table.

Follow-up prompts

  • How would you validate the performance impact of adding a composite index on the product search table?
  • What are the trade‑offs between normalizing product attributes versus using JSONB in PostgreSQL?
  • Can you recommend a monitoring strategy to catch performance regressions after changes are deployed?