← Quiz: Unique ID Generator: all 15 questions
Quiz: Unique ID Generator · Question 11 of 15
Why is MAX(id) + 1 in application code a bad way to create IDs?
Why is MAX(id) + 1 in application code a bad way to create IDs?
- A.It is too slow to compute
- B.Two requests can read the same maximum at the same time and create the same ID
- C.It only works with UUIDs
- D.Databases do not support MAX
Answer & explanation
Correct answer: Two requests can read the same maximum at the same time and create the same ID
This is a race condition; the database must generate or enforce unique IDs.
Can you get the rest right without peeking?
Take the timed Quiz: Unique ID Generator quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →