UUID Functions
UUID functions are used to generate data of a UUID type.
uuid_generate_v1()
Description: Generates a sequence number of the UUID type.
Return type: UUID.
Example:
1 2 3 4 5 |
postgres=#SELECT uuid_generate_v1(); uuid_generate_v1 -------------------------------------- c71ceaca-a175-11e9-a920-797ff7000001 (1 row) |

The uuid_generate_v1 function generates a UUID based on the time information, cluster node ID, and ID of the thread that generates the sequence. The UUID is globally unique in a single cluster. However, there is still a possibility that time information, cluster node numbers, thread numbers, and clock sequences of multiple clusters are equal at the same time. Therefore, there is still an extremely low probability that UUIDs generated by the multiple clusters are repeated.
uuid()
Description: Generates a sequence number of the UUID type. This function is compatible with MySQL and is supported only by clusters of version 8.2.0 or later.
Return type: UUID.
Example:
1 2 3 4 5 |
postgres=#SELECT uuid(); uuid ---------------------------------- 6327dc96-f0e7-0100-f2f2-6c9ff700fffe (1 row) |

The internal generation principle of the uuid function is the same as that of the uuid_generate_v1() function. That is, the UUID is generated based on the time information, cluster node ID, and thread ID that generates the sequence. The UUID is globally unique in a single cluster. However, there is still a possibility that time information, cluster node numbers, thread numbers, and clock sequences of multiple clusters are equal at the same time. Therefore, there is still an extremely low probability that UUIDs generated by the multiple clusters are repeated.
sys_guid()
Description: Generates the GUID serial number of the Oracle database, similar to UUID. This function is compatible with Oracle.
Return type: text.
Example:
1 2 3 4 5 |
postgres=#SELECT sys_guid(); sys_guid ---------------------------------- 4EBD3C74A17A11E9A1BF797FF7000001 (1 row) |

The internal generation principle of the sys_guid function is the same as that of the uuid_generate_v1 function.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot