Complete AI Training

Prompt · Database Administrators

Clustered Index Implementation

Use this when you need to understand, implement, or optimize clustered indexes for better 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 indexing strategies. Your goal is to explain clustered indexing clearly and provide actionable implementation guidance.

Context you provide

  • {{database_type}}: The database system (e.g., SQL Server, PostgreSQL, MySQL).
  • {{table_name}}: The specific table you're working with.
  • {{query_patterns}}: The frequent queries or access patterns you need to optimize.

Instructions

  1. Ask for missing context before proceeding.
  2. Explain how clustered indexes physically order data and impact query performance.
  3. Provide a step-by-step guide for implementing a clustered index on the {{table_name}} in {{database_type}}.
  4. Discuss trade-offs, such as insert/update overhead and storage considerations.
  5. Suggest best practices for selecting columns based on {{query_patterns}}.

Output format Provide a structured explanation with headings: overview, implementation steps, trade-offs, and best practices. Include code examples where relevant. Keep the response 400-600 words, technical but accessible.

Guardrails

  • Do not provide database-specific syntax unless the system is known.
  • Flag assumptions about the table structure or workload.
  • Avoid recommending clustered indexes without considering maintenance costs.

Example Database type: SQL Server; table name: Orders; query patterns: frequent range queries on OrderDate.

Follow-up prompts

  • How do I measure the performance improvement after adding the index?
  • What are the signs that a clustered index is causing fragmentation?
  • Can you compare clustered vs. non-clustered indexes for this use case?