All Questions
Database Indexing medium

What happens to a B-Tree index when you insert unrelated random keys (like UUID v4) compared to sequential keys (Integers)?

  1. A The tree structure becomes exponentially deeper with every insert, eventually leading to a O(N) traversal time for simple point-lookups.
  2. B Physical Page Fragmentation increases, as inserts occur in random pages rather than at the end, leaving pages partially empty and causing frequent splits.
  3. C The index automatically performs a 'Soft Sort' in the background to ensure that physical storage blocks remain sequentially aligned with the primary key.
  4. D There is no significant difference, as modern database engines utilize specialized SSD-aware algorithms to normalize the performance of random inserts.

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

Get the app

Related questions