PROMPT_HOOK.AI

Hyper-optimized prompt blueprints. Inject parameters, stream instant configurations.

[ SPONSORED DATA STREAM ]

Database Migration & SQL Query Optimizer - DBA AI Prompt

[ SPONSORED CONTENT STREAM ]
Programming & Dev Advanced

Core SQL Optimization Concepts

Slow database queries are the primary bottleneck in web applications. This database optimizer prompt uses schema analysis to identify missing indexes, reduntant joins, and sub-optimal search conditions.

How to Use it

Provide both the schema (create table statements) and the slow query. The output will give you the migration script and query adjustments.

Optimization Tips

  • Explain Plan: If you have access to EXPLAIN ANALYZE output, paste it into the prompt. The AI will read the exact query execution plan and target the slow nodes.
  • Identify Volume: Inform the AI about table sizes (e.g., '10 million rows'). This changes the optimization advice from simple indexing to partitioning.
Customize Prompt Parameters
AI Prompt Blueprint
Act as a Senior Database Engineer. Analyze the following current database schema and slow-running query: [Insert Database Schema & Target Query]. I am using [Insert Database Type, e.g., PostgreSQL 16]. Provide: 1. An optimized SQL query refactored for performance. 2. A structural migration script (DDL) proposing new indexes (B-Tree, Hash, GIN, etc.), partial indexes, or database partitioning if necessary. 3. A detailed explanation of why the original query was slow, analyzing index scans vs. sequential scans and JOIN mechanics.
[ SPONSORED CONTENT STREAM ]