Why UUID v4 Is a Great Default
For most apps, UUID v4 is the simplest and safest choice. It avoids metadata leaks, has excellent uniqueness properties, and doesn’t require coordination.
Strengths
- Randomness: very low collision probability at typical scales.
- Privacy: no embedded MAC or timestamps.
- Ease: available in almost every language and runtime.
Trade-offs
- Index locality: purely random values can fragment B-tree indexes.
- Ordering: not sortable by creation time unless you add metadata.
Alternatives
Some systems prefer time-ordered UUIDs (e.g., ULID) to improve index locality. Consider workload patterns before choosing.