SELECT e.extname, ne.nspname AS extschema, p.proname, np.nspname AS proschema
FROM pg_catalog.pg_extension AS e
INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid)
INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid)
INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace)
INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace)
WHERE d.deptype = 'e'
AND e.extname = 'pg_uuidv7'
ORDER BY 1, 3;
Example output:
. extname | extschema | proname | proschema
-----------+-----------+------------------------+-----------
pg_uuidv7 | public | uuid_generate_v7 | public
pg_uuidv7 | public | uuid_timestamp_to_v7 | public
pg_uuidv7 | public | uuid_timestamptz_to_v7 | public
pg_uuidv7 | public | uuid_v7_to_timestamp | public
pg_uuidv7 | public | uuid_v7_to_timestamptz | public
(5 rows)
That tells us YugabyteDB is still able to batch the multi-row insert efficiently, even when the UUIDv7 values are generated by the extension function in the column default.
So the extension-based approach gives us the same important result as the improved custom-function version:
● one write per row
● but only one flush for the batch
That is exactly what we wanted to preserve.
🧪 Other Options (Quick Mention)
There are a few alternatives:
● Generate UUIDv7 in your application (most portable)
⚡ Why UUIDv7 Matters in YugabyteDB (Final Takeaway)
UUIDv7 isn’t just a new identifier format… it’s a performance optimization for distributed databases like YugabyteDB.
Because it is time-ordered, UUIDv7 improves:
● Insert locality
● Index efficiency
● LSM compaction behavior
● Write throughput
In contrast, UUIDv4 introduces randomness that can:
● Scatter writes across tablets
● Increase compaction pressure
● Reduce cache and index efficiency
💡 Final Takeaway
If you’re using UUIDv4 as a primary key in a high-ingest workload, switching to UUIDv7 is one of the simplest high-impact performance improvements you can make in YugabyteDB.
And with the pg_uuidv7 extension, you can start using it today… no need to wait for PostgreSQL 18.
Have Fun!
Celebrating an incredible year at YugabyteDB 🌴📘 ...just cracked open Maui Revealed: The Ultimate Guidebook, and my wife has already turned our “relaxing trip” into a carefully planned adventure packed with things to do 😄 June can’t come soon enough... Maui, great teammates, and a well-earned celebration!