PGDay UK 2026 in Birmingham gathered the UK and broader European PostgreSQL community to discuss PostgreSQL 18 in production. UUID v7 was a central theme across multiple talks — the native uuidv7() built-in function eliminated the last reason to reach for the uuid-ossp extension in new deployments, and speakers presented live migration walkthroughs from existing UUID v4 installations. The event built directly on the earlier PGDay Paris 2026 sessions and the PGConf US 2026 deep-dives.

Event details

ConferencePGDay UK 2026
DateSeptember 9, 2026
LocationBirmingham, UK
FocusUUID v7 in PostgreSQL 18 — uuidv7(), index performance, migration from uuid-ossp

Key session: Native uuidv7() in PostgreSQL 18

PostgreSQL 18 ships uuidv7(), uuidv4(), and uuid_extract_timestamp() as built-in functions requiring no extension. The PGDay UK sessions opened with a live demo of the new functions:

-- PostgreSQL 18 — no CREATE EXTENSION required
SELECT uuidv7();
-- → 019434a1-7c30-7000-9abc-def012345678

SELECT uuidv4();  -- alias for gen_random_uuid()
-- → a1b2c3d4-e5f6-4000-b789-0a1b2c3d4e5f

-- Set a table column to use UUID v7 by default
CREATE TABLE events (
    id          uuid        DEFAULT uuidv7() PRIMARY KEY,
    name        text        NOT NULL,
    occurred_at timestamptz DEFAULT now()
);

-- Extract the embedded timestamp from a UUID v7
SELECT uuid_extract_timestamp(id), name
FROM events
ORDER BY id;  -- id ORDER = timestamp ORDER

The key point emphasised by speakers: ordering ORDER BY id on a UUID v7 column gives chronological order at millisecond precision — no ORDER BY occurred_at needed. See UUID v7 for the full specification.

Session: B-tree index benchmarks at scale

The benchmarks session compared UUID v4 and UUID v7 as primary keys on a 1-billion-row transactions table representing a UK payments processor:

Key type1B-row INSERT wall timeIndex sizeRange scan (last 1h)
BIGSERIAL1× (baseline)1×1× (baseline)
UUID v43.4× slower2.1× largerFull table scan
UUID v71.5× slower1.9× largerIndex range scan

UUID v7 was 2.3× faster than UUID v4 at INSERT throughput due to reduced B-tree page splits — monotonically increasing timestamps mean new rows append near the right edge of the index tree. See UUID v4 vs v7 for the full benchmark methodology.

Session: Migrating from uuid-ossp to PostgreSQL 18 builtins

The migration session walked through a zero-downtime approach for existing deployments:

-- Check which tables use uuid-ossp defaults
SELECT table_name, column_name, column_default
FROM information_schema.columns
WHERE column_default LIKE '%uuid_generate%';

-- Migrate column defaults — works online, no table lock
ALTER TABLE transactions  ALTER COLUMN id SET DEFAULT uuidv7();
ALTER TABLE customers     ALTER COLUMN id SET DEFAULT uuidv7();
ALTER TABLE audit_log     ALTER COLUMN id SET DEFAULT uuidv7();

-- Verify: new inserts get UUID v7; existing rows are unchanged
INSERT INTO transactions (amount, currency) VALUES (99.99, 'GBP')
RETURNING id, uuid_extract_timestamp(id) AS created_ts;
-- → 019434b2-1a40-7000-... | 2026-09-09 10:15:30.456+00

Existing rows retain their UUID v4 values — the uuid column type accepts both v4 and v7 without schema changes. See Zero-Downtime UUID Migration for the full dual-write strategy.

Session: uuid_extract_timestamp() for time-range queries

A highlight session demonstrated eliminating secondary created_at indexes using uuid_extract_timestamp():

-- Find all transactions in the last 6 hours using only the primary key index
SELECT id, amount, currency
FROM transactions
WHERE id >= (
    -- Build a minimum UUID v7 for "6 hours ago"
    -- lower 74 bits set to zero — sorts before any real UUID at that millisecond
    lpad(to_hex(
        (extract(epoch FROM (now() - interval '6 hours')) * 1000)::bigint
    ), 12, '0') || '-0000-7000-8000-000000000000'
)::uuid
ORDER BY id
LIMIT 500;

-- Simpler: use uuid_extract_timestamp directly
SELECT *
FROM transactions
WHERE uuid_extract_timestamp(id) > now() - interval '6 hours'
ORDER BY id;

Speakers noted that uuid_extract_timestamp() enables a new class of queries on UUID v7 tables that would previously have required a dedicated created_at column and index. See UUID in Databases.

Attendee tips

  1. Upgrade path — uuidv7() is a drop-in replacement for uuid_generate_v4() in column defaults; both return a uuid type value.
  2. No DROP EXTENSION required — uuid-ossp and the PostgreSQL 18 built-ins coexist; you can migrate incrementally table by table.
  3. Index first — add a B-tree index on your UUID column before switching to uuidv7() defaults; the new inserts will immediately benefit from the ordered key.
  4. uuid_extract_timestamp() returns NULL for v4 — safe to use in mixed-version columns.
  5. Monitor bloat — B-tree bloat from UUID v4 columns does not self-heal after migration; run VACUUM FULL or pg_repack once if historical bloat is high.

Further reading

External references

Frequently asked questions

Does PostgreSQL 18's uuidv7() guarantee monotonic ordering within the same millisecond?

PostgreSQL 18's uuidv7() does not guarantee strict monotonic ordering within the same millisecond — two calls in the same millisecond can produce UUIDs that sort in either order because the 74 random bits after the timestamp are independently generated. For strict per-session monotonicity, PostgreSQL 18 does not yet expose a sequence-based sub-millisecond counter in the built-in function. The pg_uuidv7 extension offered monotonic mode in earlier versions. See Monotonic UUID for the full discussion.

Can I index a UUID v7 column in PostgreSQL 18 and query by time range?

Yes. Because UUID v7 embeds a 48-bit Unix millisecond timestamp in the most-significant bytes, a standard B-tree index on a uuid column is inherently a time-ordered index. Range queries like WHERE id >= lower_v7 AND id < upper_v7 resolve to an index range scan — no secondary created_at index is needed. Use uuid_extract_timestamp(id) to derive the bounds. See UUID in Databases.

What does uuid_extract_timestamp() return for a UUID v4 value?

uuid_extract_timestamp() in PostgreSQL 18 returns NULL for UUID v4 values — it only decodes the timestamp field when the version nibble is 7. This makes it safe to call on mixed-version UUID columns. A query like SELECT uuid_extract_timestamp(id) FROM orders WHERE uuid_extract_timestamp(id) IS NOT NULL filters to only the UUID v7 rows. See PostgreSQL 18 Ships Native UUID v7.