All Questions
Sharding easy

In a sharded database, why is it typically a bad idea to rely on a standard database `AUTO_INCREMENT` column for your Primary Keys?

  1. A Integer-based IDs are fundamentally slower for the database to search through than text strings.
  2. B Managing a simple integer takes more CPU power than generating a complex UUID.
  3. C Each shard generates its own sequence independently, which almost guarantees 'ID Collisions' (e.g., Shard A and Shard B both assigning ID `1001` to different records).
  4. D Sharded database systems generally do not support any numerical data types for Primary Keys.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions