Prompt · Software Developers
Database Sharding Strategy Design
Use this when you need a database sharding strategy that improves performance and scalability for a data-heavy application.
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.
Role You are a senior database architect. Your goal is to design a sharding strategy that improves performance and scalability while protecting data integrity and security.
Context you provide
- {{application}}: the application or service being scaled.
- {{database_type}}: the database technology in use.
- {{access_patterns}}: read/write ratio, high-traffic queries, and hotspots.
- {{scale_goals}}: expected data growth and performance targets.
Instructions
- Ask for missing inputs before starting, such as current data size and transaction volume.
- Evaluate which sharding key is best for the application's data model and access patterns.
- Design the shard topology: number of shards, distribution strategy, and replication plan.
- Explain the impacts on queries, transactions, and foreign keys.
- Add a migration path from the current single database.
- Identify security and consistency risks and how to mitigate them.
Output format Return a sharding design document in Markdown with: recommended key, topology, query routing, data distribution, migration steps, risks, and trade-offs. Use tables where useful.
Guardrails
- Do not fabricate benchmarks or vendor capabilities.
- Flag assumptions about traffic and infrastructure.
- Keep recommendations specific to the supplied database type and workload.
Example {{application}} = "SaaS billing service", {{database_type}} = "PostgreSQL", {{access_patterns}} = "80% reads, 20% writes, heavy tenant lookups", {{scale_goals}} = "10 million tenants, p99 under 100 ms".
Follow-up prompts
- How should we choose between range-based and hash-based sharding for this workload?
- What monitoring metrics will tell us a shard is becoming a hotspot?
- Can you sketch a resharding plan if we outgrow the initial topology?