sequential_uuids
generator of sequential UUIDs
Repository
tvondra/sequential-uuids
https://github.com/tvondra/sequential-uuids
Source
sequential-uuids-1.0.3.tar.gz
sequential-uuids-1.0.3.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
sequential_uuids | 1.0.3 | FUNC | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4570 | sequential_uuids | No | Yes | No | Yes | No | Yes | - |
| Related | pg_idkit pg_uuidv7 pgx_ulid uuid-ossp pg_hashids permuteseq |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 1.0.3 | 1817161514 | sequential_uuids | - |
| RPM | PGDG | 1.0.3 | 1817161514 | sequential_uuids_$v | - |
| DEB | PIGSTY | 1.0.3 | 1817161514 | postgresql-$v-sequential-uuids | - |
Build
You can build the RPM / DEB packages for sequential_uuids using pig build:
pig build pkg sequential_uuids # build RPM / DEB packages
Install
You can install sequential_uuids directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install sequential_uuids; # Install for current active PG version
pig ext install -y sequential_uuids -v 18 # PG 18
pig ext install -y sequential_uuids -v 17 # PG 17
pig ext install -y sequential_uuids -v 16 # PG 16
pig ext install -y sequential_uuids -v 15 # PG 15
pig ext install -y sequential_uuids -v 14 # PG 14
dnf install -y sequential_uuids_18 # PG 18
dnf install -y sequential_uuids_17 # PG 17
dnf install -y sequential_uuids_16 # PG 16
dnf install -y sequential_uuids_15 # PG 15
dnf install -y sequential_uuids_14 # PG 14
apt install -y postgresql-18-sequential-uuids # PG 18
apt install -y postgresql-17-sequential-uuids # PG 17
apt install -y postgresql-16-sequential-uuids # PG 16
apt install -y postgresql-15-sequential-uuids # PG 15
apt install -y postgresql-14-sequential-uuids # PG 14
Create Extension:
CREATE EXTENSION sequential_uuids;
Usage
sequential_uuids: sequential UUID generators for better index locality
Generates UUIDs with sequential patterns to reduce random I/O in indexes while maintaining sufficient randomness to avoid collisions.
CREATE EXTENSION sequential_uuids;
Functions
| Function | Description |
|---|---|
uuid_sequence_nextval(sequence regclass, block_size int DEFAULT 65536, block_count int DEFAULT 65536) | Generate a sequential UUID based on a sequence |
uuid_time_nextval(interval_length int DEFAULT 60, interval_count int DEFAULT 65536) | Generate a sequential UUID based on current timestamp |
Examples
CREATE SEQUENCE my_seq;
-- Sequence-based UUID generation
SELECT uuid_sequence_nextval('my_seq'::regclass);
-- Time-based UUID generation (wraps around every ~45 days with defaults)
SELECT uuid_time_nextval();
-- Use as default for a column
CREATE TABLE orders (
id uuid DEFAULT uuid_time_nextval() PRIMARY KEY,
data text
);
-- Custom block size and count
SELECT uuid_sequence_nextval('my_seq', 256, 65536);
SELECT uuid_time_nextval(120, 32768);
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.