Tiger Cloud: Performance, Scale, Enterprise
Self-hosted products
MST
Create a UUIDv7 object from a Postgres timestamp for use in range queries.
ts
is converted to a UNIX timestamp split into millisecond and sub-millisecond parts.
The random bits of the UUID are set to zero in order to create a "lower" boundary UUID.
For example, you can use the returned UUIDvs to find all rows with UUIDs where the timestamp is less than the boundary UUID's timestamp.
Create a boundary UUID from a timestamp:
postgres=# SELECT to_uuidv7_boundary('2025-09-04 11:01');Returns something like:
to_uuidv7_boundary--------------------------------------019913f5-30e0-7000-8000-000000000000Use a boundary UUID to find all UUIDs with a timestamp below
'2025-09-04 10:00'
:SELECT * FROM uuid_events WHERE event_id < to_uuidv7_boundary('2025-09-04 10:00');
Name | Type | Default | Required | Description |
---|---|---|---|---|
ts | TIMESTAMPTZ | - | ✔ | The timestamp used to return a UUIDv7 object |
Keywords
Found an issue on this page?Report an issue or Edit this page
in GitHub.