UUID 생성기 자주 묻는 질문

랜덤 UUID (v4) 생성

Can UUIDs collide?

Theoretically yes, but practically no. With 122 random bits in a V4 UUID, you'd need to generate about 2.71 quintillion (2.71 × 10^18) UUIDs for a 50% collision probability. For perspective, generating one million UUIDs per second would take about 86 years to reach that threshold. For all practical purposes, properly generated V4 UUIDs are unique.

Should I use UUID as a database primary key?

UUIDs work well as primary keys, especially for distributed systems, but consider the tradeoffs. Benefits: can be generated client-side, merge databases without conflicts, don't reveal record count or order. Drawbacks: larger than integers (16 bytes vs 4-8), can impact index performance, random V4 UUIDs cause index fragmentation. Consider UUID7 (time-ordered) or ULID for better index performance.

What's the difference between UUID and GUID?

They're the same thing. UUID (Universally Unique Identifier) is the official term from RFC 4122 and is used in most contexts. GUID (Globally Unique Identifier) is Microsoft's term for the same 128-bit identifier format. Both refer to the same standard format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Are UUIDs secure for tokens?

V4 UUIDs generated with a cryptographically secure random source are unguessable and suitable for tokens like session IDs. However, for high-security applications, consider using purpose-built token libraries that provide additional security features. Never use V1 UUIDs for security-sensitive purposes—the timestamp and MAC are predictable.

How are UUIDs ordered?

V4 (random) UUIDs have no inherent ordering—sorting them alphabetically gives essentially random order. V1 (time-based) UUIDs have chronological ordering based on their timestamp component. For applications needing ordered UUIDs with randomness, consider UUID7 (proposed) or ULID, which combine timestamps with randomness for sortable unique IDs.

What's the performance impact of UUIDs?

UUIDs use 16 bytes versus 4-8 bytes for integers, increasing storage and bandwidth. Random V4 UUIDs cause B-tree index fragmentation because insertions occur at random positions. Time-based UUIDs (V1, V7) or ULIDs avoid fragmentation with sequential insertions. For high-volume systems, benchmark to measure actual impact—it's often less significant than assumed.

도구 사용해보기

랜덤 UUID (v4) 생성

UUID 생성기