Prompt · Database Administrators
Clustered Index Implementation
Use this when you need to understand, implement, or optimize clustered indexes for better database performance.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- 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
- Ask for missing context before proceeding.
- Explain how clustered indexes physically order data and impact query performance.
- Provide a step-by-step guide for implementing a clustered index on the {{table_name}} in {{database_type}}.
- Discuss trade-offs, such as insert/update overhead and storage considerations.
- 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?