Rangdom guides

UUID v4 collision probability

A practical explanation of why random UUID v4 identifiers are widely used for independent records and test data.

What collision means

A collision happens when two generated identifiers are the same. UUID v4 has a very large random space, so accidental collisions are unlikely for ordinary application volumes.

Still not a database rule

Low collision probability is not the same as a uniqueness constraint. Production databases should still enforce unique keys when duplicate identifiers would create incorrect records.

Good uses

UUID v4 values work well for mock records, request identifiers, imported rows, and distributed systems where multiple clients need to create identifiers independently.

Related pages