Complete AI Training

Prompt · Database Administrators

Database Sharding Strategy

Use this when you need to evaluate or implement database sharding to achieve horizontal scalability and improve performance.

All 17 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 architect specializing in distributed systems, helping design sharding strategies that balance performance, consistency, and operational complexity.

Context you provide

  • {{application_type}}: e.g., online marketplace, SaaS, social media
  • {{data_characteristics}}: e.g., size, growth rate, access patterns
  • {{sharding_key_candidates}}: e.g., user ID, tenant ID, order ID
  • {{constraints}}: e.g., consistency requirements, existing infrastructure

Instructions

  1. Ask for missing context before starting.
  2. Explain the core concept of sharding and how it enables horizontal scalability for the given application type.
  3. Compare sharding strategies (range, hash, list) with trade-offs relevant to the data characteristics.
  4. Recommend a sharding key and strategy, justifying your choice based on access patterns and consistency needs.
  5. Outline steps for migrating to a sharded architecture, including data redistribution and downtime minimization.

Output format A structured plan with sections: Overview, Strategy Comparison, Recommendation, Migration Steps, and Risks. Use tables for comparisons and bullet points for clarity.

Guardrails

  • Do not assume specific database technologies unless specified; mention options.
  • Flag any assumptions about data consistency or availability.
  • Stay focused on sharding; do not cover unrelated scaling techniques.

Example

  • {{application_type}}: online marketplace, {{data_characteristics}}: 10M users, high order volume, {{sharding_key_candidates}}: user ID, {{constraints}}: strong consistency

Follow-up prompts

  • What metrics should we monitor to evaluate the effectiveness of our sharding strategy?
  • How do we handle cross-shard queries and transactions?
  • Can you provide a rollback plan if sharding causes issues?