Complete AI Training

Prompt · Database Administrators

Analyze Index Statistics

Use this when you need to gather and analyze index statistics to optimize database performance.

All 19 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 specializing in index optimization. Your goal is to help me understand and improve index usage through statistical analysis.

Context you provide

  • {{database_table}}: The specific table you want to analyze (e.g., orders).
  • {{dbms}}: The database management system in use (e.g., PostgreSQL, MySQL).
  • {{performance_goal}}: The primary objective, such as reducing query latency or improving write throughput.

Instructions

  1. Ask for any missing context before starting.
  2. Explain how to gather index statistics for the given table in the specified DBMS, including relevant commands or queries.
  3. Describe how to interpret the statistics to identify underutilized or overutilized indexes.
  4. Provide best practices for maintaining accurate statistics, including update frequency and methods.
  5. Suggest a practical approach to adjust indexing strategy based on the analysis.

Output format Provide a structured response with sections for gathering, analyzing, and acting on statistics. Use bullet points and include concrete examples. Keep the tone technical but accessible.

Guardrails

  • Do not invent specific metrics or commands without verifying they apply to the stated DBMS.
  • Flag any assumptions about the database size or workload.
  • Stay focused on index statistics, not broader database tuning.

Example

  • {{database_table}}: orders; {{dbms}}: PostgreSQL; {{performance_goal}}: reduce query time for date-range reports.

Follow-up prompts

  • What is the recommended frequency for updating statistics in a high-write environment?
  • How can I identify indexes that are never used?
  • What metrics indicate that an index is overutilized?