An incrementing primary key assigns each inserted record a higher numeric identifier. It is simple and useful, but assumes one writable database instance and requires a lock during insertion. section 6.4.1
Consider the operational trade-offs before making it the default identifier:
- At very large scale, locking can reduce insert performance because records cannot be inserted concurrently. section 6.4.1
- Global UUIDs allow clients to generate unique identifiers without depending on one writable database. section 6.4.1
- Twitter’s Snowflake approach preserves sortable, increasing identifiers while supporting global generation. section 6.4.1
- Keep incrementing keys for simplicity or user-visible IDs, but omit them from tables such as session objects when they add no value. section 6.4.1
Choosing an identifier
A user-facing tweet ID may retain an incrementing form because its ordering is useful. A session object may use another identifier because an incrementing primary key adds no value. section 6.4.1
