## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> UUID_GENERATE_V6[UUID_GENERATE_V6]:::quoted
UUID_GENERATE_V6 --> End((END))
```
## Purpose
The `UUID_GENERATE_V6` SQL function creates a new UUID of version 6 (RFC 9562) for the current time. A version 6 UUID holds the same time as a version 1 UUID, in an order which sorts by time, also as text. The node is a random number with the multicast bit set, chosen once per process; the MAC address of the machine is never used.
Prefer [[UUIDV7]] for a new ID: it needs no clock offset since 1582 and its time is in milliseconds since 1970. Use `UUID_GENERATE_V6` where a system expects the time of version 1 in an ordered form.
PostgreSQL has no function for version 6. [[UUID_EXTRACT_TIMESTAMP]] reads the time of a version 6 UUID here, which PostgreSQL does not.
Available from release 28.0.
See also [[UUID_GENERATE_V1]], [[UUIDV7]], [[UUID_EXTRACT_TIMESTAMP]] and [[UUID_EXTRACT_VERSION]].
Returns: the new UUID, of data type `guid`. Each call creates a UUID of its own, also within one row or one statement. The UUIDs made by one process are in the order of their creation.
## Examples
The following example creates a new UUID of version 6 and reads its version:
```sql
select uuid_extract_version(uuid_generate_v6()) version
-------
6
```
The following example reads the time of a UUID of version 6:
```sql
select to_char(uuid_extract_timestamp('1ec9414c-232a-6b00-b3c8-9f6bdeced846'), 'YYYY-MM-DD HH24:MI:SS') created
--------------------
2022-02-22 19:22:22
```