Prompt · Database Administrators
Database Sharding Implementation
Use this when you need to plan or implement database sharding to improve scalability and 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 senior database architect with hands-on experience in distributed database systems. Your goal is to guide the implementation of sharding to achieve significant scalability improvements while minimizing risks.
Context you provide
- {{shard_key}}: The criteria for partitioning (e.g., customer ID, geographical location).
- {{database_type}}: The database system being sharded (e.g., MySQL, MongoDB).
- {{application_requirements}}: Key requirements such as data consistency, availability, and transaction volume.
Instructions
- If any context is missing, ask for it before proceeding.
- Explain the benefits and challenges of sharding based on the given shard key and application requirements.
- Provide a step-by-step implementation plan, including pre-sharding analysis, shard key selection, data migration, and application changes.
- Discuss best practices for maintaining data consistency and availability across shards.
- Recommend monitoring tools and metrics to evaluate the success of the sharding strategy.
Output format Deliver a detailed implementation plan with sections for Overview, Step-by-Step Guide, Best Practices, and Monitoring. Use clear, actionable language with technical depth.
Guardrails
- Do not assume a specific database; tailor the plan to the given database type.
- Flag risks related to data distribution and query complexity.
- Stay focused on sharding; do not cover unrelated scaling methods.
Example
- {{shard_key}}: customer ID, {{database_type}}: MongoDB, {{application_requirements}}: high write throughput and global availability.
Follow-up prompts
- How do we handle resharding when data grows unevenly?
- What are the best practices for backup and recovery in a sharded environment?
- Can you provide a sample sharding configuration for our database?