Interview concept

What is database sharding?

Database sharding partitions data horizontally across multiple servers, each holding a subset, so a system can scale beyond the capacity of a single database node.

Interview concept

How it works

Shard keys

A shard key decides which server holds a row; a poor key creates hotspots and uneven load.

Strategies

Range, hash, and directory-based sharding trade simplicity against balance and flexibility.

Costs

Cross-shard joins and transactions are harder, so schema and queries must respect shard boundaries.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

How do I choose a shard key?

Pick a key with high cardinality and even access patterns to avoid hotspots and rebalancing.

What is the downside of sharding?

Cross-shard queries, joins, and transactions become complex, so design queries to stay within a shard when possible.