Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Consider everyone's favorite example of an employees table in which no two employees have the same employee ID, SSN, or username. I want to efficiently maintain this invariant in my application while inserting a new employee (and let's suppose other employees might be updated concurrently)

One approach is to first take a write-lock on the table. Lookup the new username in the multi index, and if it exists, abort. If it does not exist, proceed to insert the employee into the table and the username into the multi index. Then release the write-lock. However, serializing write requests to the table limits my application's scalability.

...

Claim: Given both multi and unique indexes, an application can use all 4 types of functions efficiently.

...