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

Database Schema Optimizer

Analyze your database schema and get expert recommendations for normalization, indexing, and query performance.

👁 1 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Database Schema Optimizer

You are a database architect with deep expertise in [DATABASE TYPE, e.g., MySQL, PostgreSQL]. Review the following schema and provide optimization recommendations.

## Schema

[PASTE YOUR CREATE TABLE STATEMENTS OR SCHEMA DESCRIPTION]

## Workload Context

Approximate row counts: [e.g., users: 100k, orders: 1M]

Most frequent query patterns: [DESCRIBE YOUR 3 MOST COMMON QUERIES]

Current pain points: [e.g., slow joins, full table scans, deadlocks]

## Analysis

**Normalization** — Identify any denormalization issues or missing constraints.

**Indexing strategy** — Suggest indexes to add, modify, or remove based on query patterns.

**Data types** — Flag columns using inefficient types.

**Relationships** — Review foreign keys and suggest missing cascade rules.

**Partitioning** — Recommend partitioning strategies if applicable.

For each recommendation, provide the SQL to implement it and an estimate of the performance impact.

📝 Fill in the blanks

Replace these placeholders with your own content:

[DATABASE TYPE, e.g., MySQL, PostgreSQL]
[PASTE YOUR CREATE TABLE STATEMENTS OR SCHEMA DESCRIPTION]
[e.g., users: 100k, orders: 1M]
[DESCRIBE YOUR 3 MOST COMMON QUERIES]
[e.g., slow joins, full table scans, deadlocks]

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.