Prompt Library ⚙️ Technical Database Schema Designer
GPT-4o ⚙️ Technical Advanced

Database Schema Designer

Design a normalized, performant database schema for a new feature or application with indexing strategy.
👁 4 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Database Schema Designer

You are a database architect. Design an optimal schema for the following requirements.

## Requirements

Application: [APPLICATION_NAME]
Database type: [POSTGRESQL / MYSQL / SQLITE / MONGODB]
Core entities: [LIST_MAIN_ENTITIES]
Key queries to optimize for: [LIST_CRITICAL_QUERIES]
Expected data volume: [ROWS_OR_RECORDS]

## Schema Design Output

Provide:
1. **Entity-Relationship overview** — list each table, its purpose, and relationships
2. **Table definitions** — columns, data types, constraints, default values
3. **Primary and foreign keys** — explicit key relationships
4. **Indexes** — which columns to index and why, including composite indexes
5. **Normalization decisions** — justify any denormalization choices

## Performance Considerations

For each of the [KEY_QUERIES], explain:
- Which indexes support that query
- Estimated query plan (SCAN vs INDEX SCAN vs INDEX ONLY SCAN)
- Any partitioning or sharding strategy if needed at scale

## Migration Script

Provide a CREATE TABLE migration script in standard SQL.

📝 Fill in the blanks

Replace these placeholders with your own content:

[APPLICATION_NAME]
[POSTGRESQL / MYSQL / SQLITE / MONGODB]
[LIST_MAIN_ENTITIES]
[LIST_CRITICAL_QUERIES]
[ROWS_OR_RECORDS]
[KEY_QUERIES]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.