Skip to content
RED SAGSkills
hardDatabase Administrator interview question

Your single database is reaching its limits. How do you decide whether to shard, and how would you do it?

What the interviewer wants to hear

  • Try simpler options first: tuning, read replicas, caching, partitioning, bigger hardware
  • Choose a shard key that matches the main access pattern
  • Avoid hot spots and plan rebalancing
  • Cross-shard queries and transactions become hard
  • Routing layer or tools like Citus or Vitess
  • Migrate gradually with dual writes or logical replication

Model answer

Sharding adds a lot of complexity, so I first check simpler options: query and index tuning, archiving old data, partitioning, read replicas for read load, caching, connection pooling, and vertical scaling. If write volume or data size still exceeds one server, I shard. The most important choice is the shard key. It should match the main access pattern, like tenant_id or user_id, so most queries hit one shard, and it should spread load evenly. Time-based or sequential keys create hot spots. I prefer a lookup directory or many logical shards mapped to fewer physical servers, so rebalancing is easy. Cross-shard joins, global unique IDs and distributed transactions become hard, so the app design must accept that. I would consider Citus for PostgreSQL or Vitess for MySQL, and migrate gradually using logical replication and verification.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Database Administrator questions