You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/sql-reference/20-sql-functions/13-uuid-functions/gen-random-uuid.md
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: GEN_RANDOM_UUID
3
3
---
4
4
5
-
Generates a random UUID based on v4.
5
+
Generates a random UUID based on version 7, starting from version 1.2.658. Previously, this function generated UUIDs based on version 4.
6
6
7
7
## Syntax
8
8
@@ -14,14 +14,37 @@ GEN_RANDOM_UUID()
14
14
15
15
-[UUID](uuid.md)
16
16
17
+
## Why Use UUID v7?
18
+
19
+
-**Time-Based Ordering**: UUID v7 includes a timestamp, allowing events or records to be ordered chronologically by the time they were created. This is especially useful when you need to track the sequence of actions.
20
+
21
+
-**Chronological Sorting**: UUID v7 ensures that UUIDs are sorted by creation time, which is ideal for scenarios where sorting events by time is necessary, such as event logging or maintaining audit trails.
22
+
23
+
## Version Information
24
+
25
+
- Version 1.2.658 and later: UUID version upgraded from v4 to v7.
26
+
- Version prior to 1.2.658: UUID generation was based on v4.
27
+
17
28
## Examples
18
29
30
+
In an application where events are logged, maintaining the correct sequence of actions is essential. UUID v7 ensures that each event is time-ordered, making it easy to track actions chronologically.
0 commit comments