UUID (Universally Unique Identifier) stores a 128-bit value that is unique across both space and time.
Syntax
You can expressUUID values using the following formats:
CockroachDB displays all
UUID values in the standard RFC4122 format.
Size
AUUID value is 128 bits in width, but the total storage size is likely to be larger due to CockroachDB metadata.
Examples
Create a table with manually-entered UUID values
Create a table with UUID in standard RFC4122-specified format
Create a table with UUID in BYTE format
Create a table with UUID used as URN
Express UUIDs in alternate formats
Create a table with auto-generated unique row IDs
To auto-generate unique row identifiers, you can use thegen_random_uuid(), uuid_v4(), or unique_rowid() .
To use the column with the gen_random_uuid() as the :
uuid_v4() function as the default value:
unique_rowid() as the default value, either explicitly or via the :
unique_rowid() function generates a default value from the timestamp and ID of the node executing the insert. Such time-ordered values are likely to be globally unique except in cases where a very large number of IDs (100,000+) are generated per node per second. Also, there can be gaps and the order is not completely guaranteed.
To understand the differences between the UUID and unique_rowid() options, see the . For further background on UUIDs, see What is a UUID, and Why Should You Care?.
Supported casting and conversion
UUID values can be to the following data type:

