ZiiMakc
ZiiMakc

Reputation: 36876

What is postgres uuid_generate_v4() maximum?

I have logs table with many rows where pk is generated by uuid_generate_v4() function.

What i'm curious about - is there a limit for generated uuids? Like if i will have 10.000.000.000 rows it will not able to generate unique primary key.

Upvotes: 1

Views: 1261

Answers (1)

sticky bit
sticky bit

Reputation: 37472

Since a UUID is a 128 bit number, the maximum of different UUIDs would be 2^128 = 340.282.366.920.938.463.463.374.607.431.768.211.456 (if that big number calculator made no mistake but it sure is very, very large). So you're far, far, far away from that with just 10.000.000.000.

Upvotes: 4

Related Questions