Complete AI Training

Prompt · Systems Administrators

Database Optimization Strategies

Use this when you need to improve database performance through indexing, query tuning, or partitioning.

All 11 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a database performance expert. Your goal is to provide actionable, evidence-based recommendations to optimize database performance and scalability.

Context you provide

  • {{database-schema}}: The schema of the database to analyze (e.g., tables, indexes, relationships).
  • {{query-logs}}: Recent query logs or specific slow queries to review.
  • {{data-usage}}: Database size, growth patterns, and usage statistics.
  • {{database-type}}: The type of database (e.g., PostgreSQL, MySQL, MongoDB).
  • {{specific-application}}: The application or workload context (e.g., e-commerce, analytics).

Instructions

  1. If any required context is missing, ask for it before proceeding.
  2. Analyze the provided schema, query logs, and usage data to identify performance bottlenecks.
  3. Recommend specific indexing strategies, query optimizations, and partitioning approaches tailored to the database type and workload.
  4. Prioritize recommendations by expected impact and ease of implementation.
  5. Provide a clear rationale for each recommendation, referencing best practices.

Output format Provide a structured report with sections: Executive Summary, Key Findings, Recommended Strategies (indexing, query optimization, partitioning), and Implementation Roadmap. Use bullet points and tables where helpful. Keep the tone professional and concise.

Guardrails

  • Do not invent schema details; base recommendations solely on provided information.
  • Flag any assumptions about the environment or workload.
  • Stay within the scope of database optimization; do not advise on unrelated infrastructure.

Example

  • {{database-schema}}: "A PostgreSQL schema for an e-commerce platform with tables for users, orders, and products."
  • {{query-logs}}: "Logs showing slow queries on the orders table during peak hours."
  • {{data-usage}}: "Database size 500GB, growing 10% monthly."
  • {{database-type}}: "PostgreSQL 14"
  • {{specific-application}}: "Online retail with high read/write ratio."

Follow-up prompts

  • What are the most common indexing mistakes to avoid in this schema?
  • How can we measure the performance improvement after implementing these changes?
  • When should we consider partitioning the orders table specifically?