🔒

Unlock Pro Access

Get unlimited access to all premium prompts and save your favourites.

$5
One-time payment · No subscription · Instant access
600+ exclusive premium prompts
Save prompts across sessions
All future prompt additions
Early access to new categories
Upgrade for $5 →
ChatGPT Coding

Write a Database Index Optimization Guide

Prompt
Analyze database performance for [application]. Recommend indexing and query improvements. Explain reasoning.
Why it works

Proper indexing can significantly reduce query times.

If you're struggling with slow database queries in your application, ChatGPT can help you analyze performance issues and suggest specific indexing strategies without requiring expensive database consultants. This prompt is designed for developers, database administrators, and technical leads who need to optimize their databases but want a structured approach to understanding which queries are bottlenecks and exactly where to create indexes. Whether you're working with PostgreSQL, MySQL, MongoDB, or another database system, this prompt guides ChatGPT to provide actionable recommendations tailored to your specific application architecture.

Using this prompt is straightforward. Replace [application] with a clear description of what your application does and which database operations are slow. For example, you might write "an e-commerce platform where product search queries are returning results in 5+ seconds" or "a social media app where loading user timelines takes too long." The more specific you are about your application type and the actual performance problem, the better recommendations ChatGPT will provide. You can also include details about your current table structure or the queries you suspect are causing issues.

When you submit this prompt to ChatGPT, expect to receive a detailed analysis that includes specific index recommendations, explanations of why those indexes will help, potential query rewrites that improve performance, and guidance on implementation. ChatGPT will explain the reasoning behind each suggestion so you understand the database fundamentals rather than just following blind instructions. This knowledge helps you make better decisions about future optimization challenges.

For better results, provide ChatGPT with actual query execution plans or explain your current data volume and growth patterns. Mention any previous optimization attempts you've tried. This context allows ChatGPT to give more targeted advice that accounts for your specific constraints, whether that's hardware limitations, production uptime requirements, or particular database versions you're using.