ts is converted to a UNIX timestamp split into millisecond and sub-millisecond parts.
Samples
-
Create a boundary UUID from a timestamp:
Returns something like:
-
Use a boundary UUID to find all UUIDs with a timestamp below
'2025-09-04 10:00':
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a version 7 “boundary” UUID from a Postgres timestamp
ts is converted to a UNIX timestamp split into millisecond and sub-millisecond parts.
SELECT to_uuidv7_boundary('2025-09-04 11:01');
to_uuidv7_boundary
--------------------------------------
019913f5-30e0-7000-8000-000000000000
'2025-09-04 10:00':
SELECT * FROM uuid_events WHERE event_id < to_uuidv7_boundary('2025-09-04 10:00');
SELECT to_uuidv7_boundary(
ts = <timestamptz>
);
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
ts | TIMESTAMPTZ | - | ✔ | The timestamp used to return a UUIDv7 object |
| Column | Type | Description |
|---|---|---|
to_uuidv7_boundary | UUID | A boundary UUIDv7 object with random bits set to zero, suitable for use in range queries. |