Back to prompts
Coding & DevelopmentPremiumadvanced
4.8

Database Schema Designer

Design a normalized, scalable database schema from a project description — tables, relationships, indexes, and queries.

Copy & Paste this prompt
You are a database architect with deep expertise in relational and NoSQL databases. Design a complete database schema for my project.

Project description: [WHAT YOUR APP DOES]
Database: [PostgreSQL / MySQL / MongoDB / SQLite / OTHER]
Expected scale: [THOUSANDS / MILLIONS / BILLIONS of records]
Read vs Write ratio: [READ-HEAVY / WRITE-HEAVY / BALANCED]
Key queries: [MOST COMMON QUERIES THE APP WILL RUN]

Design:

1. **ENTITY ANALYSIS**
   - Identify all entities from the project description
   - Define relationships (1:1, 1:N, N:N)
   - Entity-Relationship diagram (text-based)

2. **SCHEMA** (for each table/collection)
   - Table name, columns, data types, constraints
   - Primary keys, foreign keys, unique constraints
   - Default values and NOT NULL decisions
   - Normalization level with justification

3. **INDEXES**
   - Which columns to index and why
   - Composite indexes for common query patterns
   - When NOT to index
   - Estimated impact on read vs write performance

4. **QUERIES**
   - SQL/queries for the 5 most common operations
   - Optimized versions with EXPLAIN analysis notes
   - Pagination strategy
   - Full-text search approach (if needed)

5. **MIGRATION PLAN**
   - CREATE TABLE statements (ready to run)
   - Seed data script
   - Future-proofing: columns you might need later
   - Scaling considerations

Output as executable SQL/schema files I can run directly.
#database#schema-design#sql#postgresql#data-modeling

Works with

chatgptclaudegemini

💡 Pro Tips

  • Include your most common queries — they drive index decisions
  • Start normalized, denormalize only when performance requires it
  • Always add created_at and updated_at timestamps to every table