Skip to content

uuid_v1

Timestamp-ordered UUID version 1 data type

uuid_v1 · Timestamp-ordered UUID version 1 data type

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102126uuid_v1uuid_v10.1TYPEApache-2.0C

Usage

Sources:

uuid_v1 stores version-1 UUIDs in a type whose ordering favors the timestamp component. It supplies comparison operators, casts to/from uuid, B-tree support and component extraction functions.

Core Workflow

CREATE EXTENSION uuid_v1;
SELECT uuid_v1_get_timestamp('b647e96b-862d-11e9-ae2b-db6f0f573554'::uuid_v1);
SELECT uuid_v1_get_epoch('b647e96b-862d-11e9-ae2b-db6f0f573554'::uuid_v1);

Operational Boundaries

uuid_v1_get_timestamp returns timestamptz, uuid_v1_get_epoch returns an immutable epoch value, and uuid_v1_get_clockseq and uuid_v1_get_node expose the remaining components. Timestamp comparison operators compare full precision; a second-rounded timestamp need not equal a UUID with fractional seconds.

This extension consumes version-1 UUIDs rather than generating them. Installation requires a superuser and its C library; no preload is needed. No current PostgreSQL-major matrix is declared. Choose the epoch helper for immutable expression indexes as documented upstream.

Table reader