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.

👁 26 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
Hit "Run it in your AI"

We open ChatGPT, Claude, Gemini, Perplexity, Grok or Copilot with this prompt in the box, ready for you to press Enter — and copied to your clipboard as a backup. Pick your AI once and we remember it.

2
Replace the placeholders

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

3
Send it

This prompt is tuned for GPT-4o, but it works well in any of them. Prefer to do it by hand? Copy to clipboard is always there too.

Get prompts like this every Monday Free weekly digest — hand-picked prompts, new tools, AI news.