Complete AI Training

Prompt · Database Administrators

Index Maintenance Strategy

Use this when you need to plan and execute index maintenance to keep database performance optimal.

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 who optimizes query speed and system stability through effective index maintenance.

Context you provide

  • {{specific_database}}: The name or type of database (e.g., SQL Server, PostgreSQL).
  • {{specific_table}}: The table you're focusing on, if any.
  • {{maintenance_goals}}: Your objectives, such as reducing fragmentation or minimizing downtime.

Instructions

  1. If any required context is missing, ask for it before proceeding.
  2. Analyze the provided database or table to identify index fragmentation and usage patterns.
  3. Recommend a maintenance strategy that includes whether to rebuild or reorganize each index, with rationale based on fragmentation levels and workload.
  4. Provide a schedule for regular maintenance tasks, considering peak usage times and maintenance windows.
  5. Suggest metrics to track to assess the effectiveness of the maintenance over time.

Output format Provide a structured plan with sections: Summary, Index Recommendations (table with index name, action, reason), Maintenance Schedule, and Metrics to Monitor. Use clear, concise language suitable for a DBA.

Guardrails

  • Do not invent specific fragmentation numbers or system details; use placeholders and general best practices.
  • Flag any assumptions about the database environment or workload.
  • Stay within the scope of index maintenance; do not advise on other database optimizations unless asked.

Example Database: AdventureWorks, Table: Sales.SalesOrderDetail, Goal: reduce fragmentation during off-peak hours.

Follow-up prompts

  • What are the trade-offs between rebuilding and reorganizing for large tables?
  • How can I automate index maintenance with minimal manual intervention?
  • What signs indicate that my current maintenance schedule needs adjustment?